Package org.apache.lucene.index

Examples of org.apache.lucene.index.StoredFieldVisitor


   * @return the name of the input doc as extracted from the index.
   * @throws IOException if cannot extract the doc name from the index.
   */
  public String docName(IndexSearcher searcher, int docid) throws IOException {
    final List<String> name = new ArrayList<String>();
    searcher.getIndexReader().document(docid, new StoredFieldVisitor() {
        @Override
        public void stringField(FieldInfo fieldInfo, String value) {
          name.add(value);
        }

View Full Code Here


  }
 
  protected Field[] getFields( IndexReader reader, int docId, final String fieldName) throws IOException {
    // according to javadoc, doc.getFields(fieldName) cannot be used with lazy loaded field???
    final List<Field> fields = new ArrayList<Field>();
    reader.document(docId, new StoredFieldVisitor() {
       
        @Override
        public void stringField(FieldInfo fieldInfo, String value) {
          FieldType ft = new FieldType(TextField.TYPE_STORED);
          ft.setStoreTermVectors(fieldInfo.hasVectors());
View Full Code Here

  }
 
  protected Field[] getFields( IndexReader reader, int docId, final String fieldName) throws IOException {
    // according to javadoc, doc.getFields(fieldName) cannot be used with lazy loaded field???
    final List<Field> fields = new ArrayList<Field>();
    reader.document(docId, new StoredFieldVisitor() {
       
        @Override
        public void stringField(FieldInfo fieldInfo, String value) {
          FieldType ft = new FieldType(TextField.TYPE_STORED);
          ft.setStoreTermVectors(fieldInfo.hasVectors());
View Full Code Here

      }
    }
  }

  private static String getRowId(IndexReader reader, int docId) throws CorruptIndexException, IOException {
    reader.document(docId, new StoredFieldVisitor() {
      @Override
      public Status needsField(FieldInfo fieldInfo) throws IOException {
        if (ROW_ID.equals(fieldInfo.name)) {
          return StoredFieldVisitor.Status.STOP;
        }
View Full Code Here

      throw new RuntimeException("Reader has to be a BaseCompositeReader [" + reader + "]");
    }
  }

  private static String getRowId(IndexReader reader, int docId) throws CorruptIndexException, IOException {
    reader.document(docId, new StoredFieldVisitor() {
      @Override
      public Status needsField(FieldInfo fieldInfo) throws IOException {
        if (ROW_ID.equals(fieldInfo.name)) {
          return StoredFieldVisitor.Status.STOP;
        }
View Full Code Here

        IndexOptions.DOCS_ONLY, DocValuesType.SORTED, DocValuesType.SORTED,
        1l, null );
  }

  public static void assertFieldSelectorDisabled() {
    StoredFieldVisitor fieldVisitor = FieldSelectorLeakingReaderProvider.fieldSelector;
    //DocumentStoredFieldVisitor is the type of the default fieldVisitor, so it's expected:
    assertTrue( fieldVisitor == null || fieldVisitor instanceof DocumentStoredFieldVisitor );
  }
View Full Code Here

  }
 
  protected Field[] getFields( IndexReader reader, int docId, final String fieldName) throws IOException {
    // according to javadoc, doc.getFields(fieldName) cannot be used with lazy loaded field???
    final List<Field> fields = new ArrayList<>();
    reader.document(docId, new StoredFieldVisitor() {
       
        @Override
        public void stringField(FieldInfo fieldInfo, String value) {
          FieldType ft = new FieldType(TextField.TYPE_STORED);
          ft.setStoreTermVectors(fieldInfo.hasVectors());
View Full Code Here

   * @return the name of the input doc as extracted from the index.
   * @throws IOException if cannot extract the doc name from the index.
   */
  public String docName(IndexSearcher searcher, int docid) throws IOException {
    final List<String> name = new ArrayList<>();
    searcher.getIndexReader().document(docid, new StoredFieldVisitor() {
        @Override
        public void stringField(FieldInfo fieldInfo, String value) {
          name.add(value);
        }

View Full Code Here

TOP

Related Classes of org.apache.lucene.index.StoredFieldVisitor

Copyright © 2018 www.massapicom. 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.