Examples of StringField


Examples of org.apache.lucene.document.StringField

        TEST_VERSION_CURRENT, new MockAnalyzer(random)));
    // we don't need many documents to assert this, but don't use one document either
    int numDocs = atLeast(random, 50);
    for (int i = 0; i < numDocs; i++) {
      Document doc = new Document();
      doc.add(new StringField("f", "doc", Store.NO));
      writer.addDocument(doc);
    }
    writer.close();
   
    Term term = new Term("f", new BytesRef("doc"));
View Full Code Here

Examples of org.apache.lucene.document.StringField

    IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
    conf.setCodec(oldCodecs[random().nextInt(oldCodecs.length)]);
    IndexWriter writer = new IndexWriter(dir, conf);
   
    Document doc = new Document();
    doc.add(new StringField("f", "bar", Store.YES));
    doc.add(new NumericDocValuesField("n", 18L));
    writer.addDocument(doc);
   
    OLD_FORMAT_IMPERSONATION_IS_ACTIVE = false;
    try {
View Full Code Here

Examples of org.apache.lucene.document.StringField

            // (e.g., Washington State's population is more than 10x that of Washington, DC
            // but Washington, DC is mentioned far more frequently than Washington State)
            doc.add(new LongField(SORT_POP.key(), geoName.getPopulation(), Field.Store.YES));
        }
        doc.add(new IntField(HISTORICAL.key(), IndexField.getBooleanIndexValue(geoName.getFeatureCode().isHistorical()), Field.Store.NO));
        doc.add(new StringField(FEATURE_CODE.key(), geoName.getFeatureCode().name(), Field.Store.NO));

        // create a unique Document for each name of this GeoName
        TextField nameField = new TextField(INDEX_NAME.key(), "", Field.Store.YES);
        doc.add(nameField);
        for (String name : names) {
View Full Code Here

Examples of org.apache.lucene.document.StringField

  public void addDocument(final String id, final String json)
  throws IOException {
    final Document doc = new Document();

    doc.add(new StringField(DEFAULT_ID_FIELD, id, Store.YES));

    final FieldType sirenFieldType = new FieldType();
    sirenFieldType.setIndexed(true);
    sirenFieldType.setTokenized(true);
    sirenFieldType.setOmitNorms(true);
View Full Code Here

Examples of org.apache.lucene.document.StringField

        _localTmpWriter = new IndexWriter(_localTmpDir, _overFlowConf.clone());
        // The local tmp writer has merging disabled so the first document in is
        // going to be doc 0.
        // Therefore the first document added is the prime doc
        List<List<Field>> docs = new ArrayList<List<Field>>(_documents.values());
        docs.get(0).add(new StringField(BlurConstants.PRIME_DOC, BlurConstants.PRIME_DOC_VALUE, Store.NO));
        _localTmpWriter.addDocuments(docs);
      } else {
        _localTmpWriter.addDocuments(_documents.values());
      }
      _documents.clear();
View Full Code Here

Examples of org.apache.lucene.document.StringField

            _writer.addDocument(getDeleteDoc());
            _rowDeleteCount.increment(1);
          }
        } else {
          List<List<Field>> docs = new ArrayList<List<Field>>(_documents.values());
          docs.get(0).add(new StringField(BlurConstants.PRIME_DOC, BlurConstants.PRIME_DOC_VALUE, Store.NO));
          _writer.addDocuments(docs);
          _recordRateCounter.mark(_documents.size());
          _documents.clear();
        }
      }
View Full Code Here

Examples of org.apache.lucene.document.StringField

      _rowCount.increment(1);
    }

    private Document getDeleteDoc() {
      Document document = new Document();
      document.add(new StringField(BlurConstants.ROW_ID, _deletedRowId, Store.NO));
      document.add(new StringField(BlurConstants.DELETE_MARKER, BlurConstants.DELETE_MARKER_VALUE, Store.NO));
      return document;
    }
View Full Code Here

Examples of org.apache.lucene.document.StringField

      }

      if (numericValue != null) {
        if (shouldNumberBeHighlighted(name, numericValue, fieldFixedQuery)) {
          String numberHighlight = preTag + text + postTag;
          result.add(new StringField(name, numberHighlight, Store.YES));
        }
      } else {
        Highlighter highlighter = new Highlighter(htmlFormatter, new QueryScorer(fieldFixedQuery, name));
        TokenStream tokenStream = TokenSources.getAnyTokenStream(reader, docId, name, analyzer);
        TextFragment[] frag = highlighter.getBestTextFragments(tokenStream, text, false, 10);
        for (int j = 0; j < frag.length; j++) {
          if ((frag[j] != null) && (frag[j].getScore() > 0)) {
            result.add(new StringField(name, frag[j].toString(), Store.YES));
          }
        }
      }
    }
    return result;
View Full Code Here

Examples of org.apache.lucene.document.StringField

     */
    private FieldFactory() {
    }

    public static Field newPathField(String path) {
        return new StringField(PATH, path, YES);
    }
View Full Code Here

Examples of org.apache.lucene.document.StringField

    }

    public static Field newPropertyField(String name, String value) {
        // TODO do we need norms info on the indexed fields ? TextField:StringField
        // return new TextField(name, value, NO);
        return new StringField(name, value, NO);
    }
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.