Package org.apache.blur.thrift.generated

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


public class BlurQueryHelper {

  public static BlurQuery from(SolrParams p) {
    BlurQuery blurQuery = new BlurQuery();

    Query query = new Query();
    query.setRowQuery(false);

    maybeAddSelector(blurQuery, p);

    query.setQuery(p.get(CommonParams.Q));

    blurQuery.setQuery(query);
    return blurQuery;
  }
View Full Code Here


    return doc;
  }

  private void assertTotalResults(String table, String q, long expected) throws BlurException, TException {
    BlurQuery bquery = new BlurQuery();
    Query query = new Query();
    query.setQuery(q);
    bquery.setQuery(query);
    BlurResults results = client().query(table, bquery);

    assertEquals("Should find our row.", expected, results.getTotalResults());
  }
View Full Code Here

    assertEquals("Should find our row.", expected, results.getTotalResults());
  }

  private void assertTotalRecordResults(String table, String q, long expected) throws BlurException, TException {
    BlurQuery bquery = new BlurQuery();
    Query query = new Query();
    query.setQuery(q);
    query.setRowQuery(false);
    bquery.setQuery(query);

    BlurResults results = client().query(table, bquery);

    assertEquals("Should find our record.", expected, results.getTotalResults());
View Full Code Here

  @SuppressWarnings("unchecked")
  public static BlurQuery getBlurQuery(CommandLine commandLine) {
    List<String> argList = commandLine.getArgList();
    Option[] options = commandLine.getOptions();

    Query query = new Query();
    // Start at 2 because 1st arg is command 2nd is table
    query.setQuery(join(argList.subList(2, argList.size()), " "));
    if (commandLine.hasOption(DISABLE_ROW_QUERY)) {
      query.setRowQuery(false);
    }
    if (commandLine.hasOption(SCORE_TYPE)) {
      String scoreTypeStr = commandLine.getOptionValue(SCORE_TYPE);
      ScoreType scoreType = ScoreType.valueOf(scoreTypeStr.toUpperCase());
      query.setScoreType(scoreType);
    }
    if (commandLine.hasOption(RECORD_FILTER)) {
      String recordFilter = commandLine.getOptionValue(RECORD_FILTER);
      query.setRecordFilter(recordFilter);
    }
    if (commandLine.hasOption(ROW_FILTER)) {
      String rowFilter = commandLine.getOptionValue(ROW_FILTER);
      query.setRecordFilter(rowFilter);
    }

    // String recordFilter;
    // String rowFilter;
    // String rowId;
    // long start;
    // int fetch;
    // long maxQueryTime;
    // long minimumNumberOfResults;
    // List<Facet> facets;
    // List<SortField> sortFields;

    BlurQuery blurQuery = new BlurQuery();
    blurQuery.setQuery(query);
    Selector selector = new Selector(Main.selector);
    if (!query.isRowQuery()) {
      selector.setRecordOnly(true);
    }
    blurQuery.setSelector(selector);
    blurQuery.setCacheResult(false);
    blurQuery.setUseCacheIfPresent(false);
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);
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);
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);
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);
View Full Code Here

      LOG.warn(
          "Number of rows/records requested to be fetched [{0}] is greater than the minimum number of results [{1}]",
          blurQuery.fetch, blurQuery.minimumNumberOfResults);
      blurQuery.fetch = (int) blurQuery.minimumNumberOfResults;
    }
    Query query = blurQuery.getQuery();
    if (blurQuery.getRowId() != null) {
      if (query.isRowQuery()) {
        throw new BException("Query [{0}] in BlurQuery [{1}] cannot be a rowquery when rowId is supplied.", query,
            blurQuery);
      }
    }
    List<SortField> sortFields = blurQuery.getSortFields();
    if (sortFields != null && !sortFields.isEmpty()) {
      boolean rowQuery = query.isRowQuery();
      if (rowQuery) {
        throw new BException("Query [{0}] in BlurQuery [{1}] cannot be a rowquery when sortfields are supplied.",
            query, blurQuery);
      }
    }
View Full Code Here

  }

  @Test
  public void testQueryWithJoinAll() throws Exception {
    BlurQuery blurQuery = new BlurQuery();
    blurQuery.query = new Query();
    blurQuery.query.query = "+<+test-family.testcol12:value101 +test-family.testcol13:value102> +<test-family2.testcol18:value501>";

    blurQuery.query.rowQuery = true;
    blurQuery.query.scoreType = ScoreType.SUPER;
    blurQuery.fetch = 10;
View Full Code Here

TOP

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

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.