Package org.apache.blur.thrift.generated

Examples of org.apache.blur.thrift.generated.HighlightOptions


    }
  }

  private Query getHighlightQuery(Selector selector, String table, FieldManager fieldManager) throws ParseException,
      BlurException {
    HighlightOptions highlightOptions = selector.getHighlightOptions();
    if (highlightOptions == null) {
      return null;
    }
    org.apache.blur.thrift.generated.Query query = highlightOptions.getQuery();
    if (query == null) {
      return null;
    }

    TableContext context = getTableContext(table);
View Full Code Here


        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)) {
        fetchResult.exists = false;
        fetchResult.deleted = true;
        return;
      } else {
        fetchResult.exists = true;
        fetchResult.deleted = false;
        String rowId = getRowId(reader, docId);
        Term term = new Term(ROW_ID, rowId);
        if (returnIdsOnly) {
          int recordCount = BlurUtil.countDocuments(reader, term);
          fetchResult.rowResult = new FetchRowResult();
          fetchResult.rowResult.row = new Row(rowId, null, recordCount);
        } else {
          List<Document> docs;
          if (highlightQuery != null && fieldManager != null) {
            HighlightOptions highlightOptions = selector.getHighlightOptions();
            String preTag = highlightOptions.getPreTag();
            String postTag = highlightOptions.getPostTag();
            docs = HighlightHelper.highlightDocuments(reader, term, fieldVisitor, selector, highlightQuery,
                fieldManager, preTag, postTag);
          } else {
            docs = BlurUtil.fetchDocuments(reader, term, fieldVisitor, selector, maxHeap, table + "/" + shard);
          }
View Full Code Here

          selector.setColumnsToFetch(EMPTY_MAP);
          if (!blurQuery.query.rowQuery) {
            selector.setRecordOnly(true);
          }
        } else {
          HighlightOptions highlightOptions = selector.getHighlightOptions();
          if (highlightOptions != null && highlightOptions.getQuery() == null) {
            highlightOptions.setQuery(blurQuery.getQuery());
          }
        }
        blurQuery.setSelector(null);

        BlurCommand<BlurResultIterable> command = new BlurCommand<BlurResultIterable>() {
View Full Code Here

  }

  @Test
  public void testFetchRowByRowIdHighlighting() throws Exception {
    Selector selector = new Selector().setRowId("row-6");
    HighlightOptions highlightOptions = new HighlightOptions();
    Query query = new Query();
    query.setQuery(FAMILY2 + ".testcol13:value105 " + FAMILY + ".testcol12:value101");
    highlightOptions.setQuery(query);
    selector.setHighlightOptions(highlightOptions);
    FetchResult fetchResult = new FetchResult();
    indexManager.fetchRow(TABLE, selector, fetchResult);

    assertNotNull(fetchResult.rowResult.row);
View Full Code Here

  }
 
  @Test
  public void testFetchRowByRowIdHighlightingWithFullText() throws Exception {
    Selector selector = new Selector().setRowId("row-6");
    HighlightOptions highlightOptions = new HighlightOptions();
    Query query = new Query();
    query.setQuery("cool value101");
    highlightOptions.setQuery(query);
    selector.setHighlightOptions(highlightOptions);
    FetchResult fetchResult = new FetchResult();
    indexManager.fetchRow(TABLE, selector, fetchResult);

    assertNotNull(fetchResult.rowResult.row);
View Full Code Here

  }
 
  @Test
  public void testFetchRowByRowIdHighlightingWithFullTextWildCard() throws Exception {
    Selector selector = new Selector().setRowId("row-6");
    HighlightOptions highlightOptions = new HighlightOptions();
    Query query = new Query();
    query.setQuery("cool ?alue101");
    highlightOptions.setQuery(query);
    selector.setHighlightOptions(highlightOptions);
    FetchResult fetchResult = new FetchResult();
    indexManager.fetchRow(TABLE, selector, fetchResult);

    assertNotNull(fetchResult.rowResult.row);
View Full Code Here

  }

  @Test
  public void testFetchRecordByLocationIdHighlighting() throws Exception {
    Selector selector = new Selector().setLocationId(SHARD_NAME + "/0").setRecordOnly(true);
    HighlightOptions highlightOptions = new HighlightOptions();
    Query query = new Query();
    query.setQuery(FAMILY + ".testcol1:value1");
    query.setRowQuery(false);
    highlightOptions.setQuery(query);
    selector.setHighlightOptions(highlightOptions);
    FetchResult fetchResult = new FetchResult();
    indexManager.fetchRow(TABLE, selector, fetchResult);
    assertNull(fetchResult.rowResult);
    assertNotNull(fetchResult.recordResult.record);
View Full Code Here

    try {
      checkSelectorFetchSize(blurQuery.getSelector());
      BlurQuery original = new BlurQuery(blurQuery);
      Selector selector = original.getSelector();
      if (selector != null) {
        HighlightOptions highlightOptions = selector.getHighlightOptions();
        if (highlightOptions != null && highlightOptions.getQuery() == null) {
          highlightOptions.setQuery(blurQuery.getQuery());
        }
      }

      if (blurQuery.useCacheIfPresent) {
        LOG.debug("Using cache for query [{0}] on table [{1}].", blurQuery, table);
View Full Code Here

    blurQuery.setSelector(Main.selector);
    blurQuery.setCacheResult(false);
    blurQuery.setUseCacheIfPresent(false);

    if (Main.highlight) {
      blurQuery.getSelector().setHighlightOptions(new HighlightOptions());
    }

    if (Main.debug) {
      out.println(blurQuery);
    }
View Full Code Here

      _queryChecker.checkQuery(blurQuery);
      checkSelectorFetchSize(blurQuery.getSelector());
      BlurQuery original = new BlurQuery(blurQuery);
      Selector selector = original.getSelector();
      if (selector != null) {
        HighlightOptions highlightOptions = selector.getHighlightOptions();
        if (highlightOptions != null && highlightOptions.getQuery() == null) {
          highlightOptions.setQuery(blurQuery.getQuery());
        }
      }

      // Note: Querying the Shard Server directly if query.startTime == 0
      BlurUtil.setStartTime(blurQuery);
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.HighlightOptions

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.