Package org.apache.blur.utils

Examples of org.apache.blur.utils.ResetableDocumentStoredFieldVisitor


      // exit early
      returnIdsOnly = true;
    }

    Bits liveDocs = MultiFields.getLiveDocs(reader);
    ResetableDocumentStoredFieldVisitor fieldVisitor = getFieldSelector(selector);
    if (selector.isRecordOnly()) {
      // select only the row for the given data or location id.
      if (liveDocs != null && !liveDocs.get(docId)) {
        fetchResult.exists = false;
        fetchResult.deleted = true;
        return;
      } else {
        fetchResult.exists = true;
        fetchResult.deleted = false;
        reader.document(docId, fieldVisitor);
        Document document = fieldVisitor.getDocument();
        if (highlightQuery != null && fieldManager != null) {
          HighlightOptions highlightOptions = selector.getHighlightOptions();
          String preTag = highlightOptions.getPreTag();
          String postTag = highlightOptions.getPostTag();
          try {
            document = HighlightHelper
                .highlight(docId, document, highlightQuery, fieldManager, reader, preTag, postTag);
          } catch (InvalidTokenOffsetsException e) {
            LOG.error("Unknown error while tring to highlight", e);
          }
        }
        fieldVisitor.reset();
        fetchResult.recordResult = getRecord(document);
        return;
      }
    } else {
      if (liveDocs != null && !liveDocs.get(docId)) {
View Full Code Here


  private static String getColumnFamily(String fieldName) {
    return fieldName.substring(0, fieldName.lastIndexOf('.'));
  }

  public static ResetableDocumentStoredFieldVisitor getFieldSelector(final Selector selector) {
    return new ResetableDocumentStoredFieldVisitor() {
      @Override
      public Status needsField(FieldInfo fieldInfo) throws IOException {
        if (ROW_ID.equals(fieldInfo.name)) {
          return StoredFieldVisitor.Status.YES;
        }
View Full Code Here

  protected List<Document> documentsToIndex(List<Document> list) {
    return list;
  }

  protected void fetchOldRecords() throws IOException {
    List<Document> docs = BlurUtil.fetchDocuments(_reader, _rowIdTerm, new ResetableDocumentStoredFieldVisitor(),
        new Selector(), Integer.MAX_VALUE, "reducer-context");
    for (Document document : docs) {
      String recordId = document.get(RECORD_ID);
      // add them to the new records if the new records do not contain them.
      if (!_newDocs.containsKey(recordId)) {
View Full Code Here

      }

      Tracer t1 = Trace.trace("fetchRow - live docs");
      Bits liveDocs = MultiFields.getLiveDocs(reader);
      t1.done();
      ResetableDocumentStoredFieldVisitor fieldVisitor = getFieldSelector(selector);
      if (selector.isRecordOnly()) {
        // select only the row for the given data or location id.
        if (isFiltered(docId, reader, filter)) {
          fetchResult.exists = false;
          fetchResult.deleted = false;
          return;
        } else if (liveDocs != null && !liveDocs.get(docId)) {
          fetchResult.exists = false;
          fetchResult.deleted = true;
          return;
        } else {
          fetchResult.exists = true;
          fetchResult.deleted = false;
          reader.document(docId, fieldVisitor);
          Document document = fieldVisitor.getDocument();
          if (highlightQuery != null && fieldManager != null) {
            HighlightOptions highlightOptions = selector.getHighlightOptions();
            String preTag = highlightOptions.getPreTag();
            String postTag = highlightOptions.getPostTag();
            try {
              document = HighlightHelper.highlight(docId, document, highlightQuery, fieldManager, reader, preTag,
                  postTag);
            } catch (InvalidTokenOffsetsException e) {
              LOG.error("Unknown error while tring to highlight", e);
            }
          }
          fieldVisitor.reset();
          fetchResult.recordResult = getRecord(document);
          return;
        }
      } else {
        Tracer trace = Trace.trace("fetchRow - Row read");
View Full Code Here

  private static String getColumnFamily(String fieldName) {
    return fieldName.substring(0, fieldName.lastIndexOf('.'));
  }

  public static ResetableDocumentStoredFieldVisitor getFieldSelector(final Selector selector) {
    return new ResetableDocumentStoredFieldVisitor() {
      @Override
      public Status needsField(FieldInfo fieldInfo) throws IOException {
        if (ROW_ID.equals(fieldInfo.name)) {
          return StoredFieldVisitor.Status.YES;
        }
View Full Code Here

TOP

Related Classes of org.apache.blur.utils.ResetableDocumentStoredFieldVisitor

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.