Package org.apache.lucene.document

Examples of org.apache.lucene.document.Document.removeFields()


            if (dataBytes!=null && dataBytes.length>0) {
              hit.setSrcData(new String(dataBytes,"UTF-8"));
            }
          }
          doc.removeFields(SenseiSchema.SRC_DATA_COMPRESSED_FIELD_NAME);
          doc.removeFields(SenseiSchema.SRC_DATA_FIELD_NAME);
        }
        catch(Exception e)
        {
          res.addError(new SenseiError(e.getMessage(),ErrorType.BrokerGatherError));
          logger.error(e.getMessage(),e);
View Full Code Here


        public Document document(int n, FieldSelector fieldSelector)
                throws CorruptIndexException, IOException {
            Document doc = super.document(n, fieldSelector);
            Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES);
            if (fields != null) {
                doc.removeFields(FieldNames.PROPERTIES);
                for (int i = 0; i < fields.length; i++) {
                    String value = fields[i].stringValue();
                    value = value.replace('\uFFFF', '[');
                    doc.add(new Field(FieldNames.PROPERTIES, value,
                            Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
View Full Code Here

                if (uriCount==null) {
                    Field[] uriFields = doc.getFields(LuceneManager.DBpediaResourceField.URI.toString());
                    support = uriFields.length;
                    uriCount = this.mLucene.getUriCountField(support);
                    doc.add(uriCount); // add count
                    doc.removeFields(LuceneManager.DBpediaResourceField.URI.toString()); // remove repeated fields
                    doc.add(uriFields[0]); // add only once
                }
                else support = new Integer(uriCount.stringValue());
                LOG.trace(String.format("URI count for %s = %d",uri,support));
View Full Code Here

      {
         Document doc = super.document(n, fieldSelector);
         Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES);
         if (fields != null)
         {
            doc.removeFields(FieldNames.PROPERTIES);
            for (int i = 0; i < fields.length; i++)
            {
               String value = fields[i].stringValue();
               value = value.replace('\uFFFF', '[');
               doc.add(new Field(FieldNames.PROPERTIES, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
View Full Code Here

      {
         Document doc = super.document(n, fieldSelector);
         Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES);
         if (fields != null)
         {
            doc.removeFields(FieldNames.PROPERTIES);
            for (int i = 0; i < fields.length; i++)
            {
               String value = fields[i].stringValue();
               value = value.replace('\uFFFF', '[');
               doc.add(new Field(FieldNames.PROPERTIES, value, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
View Full Code Here

            query.add(NumericRangeQuery.newLongRange(UID_FIELD, range.getUidFrom(), range.getUidTo(), true, true), BooleanClause.Occur.MUST);
            TopDocs docs = searcher.search(query, 100000);
            ScoreDoc[] sDocs = docs.scoreDocs;
            for (int i = 0; i < sDocs.length; i++) {
                Document doc = searcher.doc(sDocs[i].doc);
                doc.removeFields(FLAGS_FIELD);
                indexFlags(f, doc);
                writer.updateDocument(new Term(ID_FIELD, doc.get(ID_FIELD)), doc);
            }
        } catch (IOException e) {
            throw new MailboxException("Unable to add messages in index", e);
View Full Code Here

            ScoreDoc[] sDocs = docs.scoreDocs;
            for (int i = 0; i < sDocs.length; i++) {
                Document doc = searcher.doc(sDocs[i].doc);
               
                if (doc.getField(FLAGS_FIELD) == null) {
                    doc.removeFields(FLAGS_FIELD);
                    indexFlags(doc, f);

                    writer.updateDocument(new Term(ID_FIELD, doc.get(ID_FIELD)), doc);
           
                }
View Full Code Here

        public Document document(int n, FieldSelector fieldSelector)
                throws CorruptIndexException, IOException {
            Document doc = super.document(n, fieldSelector);
            Fieldable[] fields = doc.getFieldables(FieldNames.PROPERTIES);
            if (fields != null) {
                doc.removeFields(FieldNames.PROPERTIES);
                for (int i = 0; i < fields.length; i++) {
                    String value = fields[i].stringValue();
                    value = value.replace('\uFFFF', '[');
                    doc.add(new Field(FieldNames.PROPERTIES, value,
                            Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
View Full Code Here

        for (GeoCoordinateField geoField: geoFields) {
            //process field into GeoIndex here
            geoIndexer.index(docID, geoField);
           
            doc.removeFields(geoField.name());
        }
       
        return defaultDocConsumerPerThread.processDocument();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.