Package org.apache.lucene.search

Examples of org.apache.lucene.search.Filter


      CacheQuery cacheQuery = Search.getSearchManager(cache).getQuery(luceneQuery);
      List<Object> found = cacheQuery.list();

      assert found.size() == 2;

      Filter filter = new PrefixFilter(new Term("blurb", "cheese"));

      cacheQuery.filter(filter);

      found = cacheQuery.list();
View Full Code Here


            ddq.add("dim" + dim, value);
          }
        }
      }

      Filter filter;
      if (random().nextInt(7) == 6) {
        if (VERBOSE) {
          System.out.println("  only-even filter");
        }
        filter = new Filter() {
            @Override
            public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
              int maxDoc = context.reader().maxDoc();
              final FixedBitSet bits = new FixedBitSet(maxDoc);
              for(int docID=0;docID < maxDoc;docID++) {
View Full Code Here

        }
      }

      FacetsCollector sfc = new FacetsCollector();
      s.search(new MatchAllDocsQuery(), sfc);
      Filter fastMatchFilter;
      if (random().nextBoolean()) {
        if (random().nextBoolean()) {
          fastMatchFilter = NumericRangeFilter.newLongRange("field", minValue, maxValue, true, true);
        } else {
          fastMatchFilter = NumericRangeFilter.newLongRange("field", minAcceptedValue, maxAcceptedValue, true, true);
View Full Code Here

        }
      }

      FacetsCollector sfc = new FacetsCollector();
      s.search(new MatchAllDocsQuery(), sfc);
      Filter fastMatchFilter;
      if (random().nextBoolean()) {
        if (random().nextBoolean()) {
          fastMatchFilter = NumericRangeFilter.newFloatRange("field", minValue, maxValue, true, true);
        } else {
          fastMatchFilter = NumericRangeFilter.newFloatRange("field", minAcceptedValue, maxAcceptedValue, true, true);
View Full Code Here

        }
      }

      FacetsCollector sfc = new FacetsCollector();
      s.search(new MatchAllDocsQuery(), sfc);
      Filter fastMatchFilter;
      if (random().nextBoolean()) {
        if (random().nextBoolean()) {
          fastMatchFilter = NumericRangeFilter.newDoubleRange("field", minValue, maxValue, true, true);
        } else {
          fastMatchFilter = NumericRangeFilter.newDoubleRange("field", minAcceptedValue, maxAcceptedValue, true, true);
View Full Code Here

        new DoubleRange("< 5", 0.0, true, 5.0, false),
        new DoubleRange("< 10", 0.0, true, 10.0, false),
        new DoubleRange("< 20", 0.0, true, 20.0, false),
        new DoubleRange("< 50", 0.0, true, 50.0, false)};

    final Filter fastMatchFilter;
    final AtomicBoolean filterWasUsed = new AtomicBoolean();
    if (random().nextBoolean()) {
      // Sort of silly:
      fastMatchFilter = new CachingWrapperFilter(new QueryWrapperFilter(new MatchAllDocsQuery())) {
          @Override
View Full Code Here

  public Weight createWeight(IndexSearcher searcher) throws IOException {
    final Weight baseWeight = baseQuery.createWeight(searcher);
    final Object[] drillDowns = new Object[drillDownQueries.length];
    for(int dim=0;dim<drillDownQueries.length;dim++) {
      Query query = drillDownQueries[dim];
      Filter filter = DrillDownQuery.getFilter(query);
      if (filter != null) {
        drillDowns[dim] = filter;
      } else {
        // TODO: would be nice if we could say "we will do no
        // scoring" here....
View Full Code Here

      return new CustomScoreQuery(strategy.makeQuery(args), new FunctionQuery(valueSource));
    } else {
      //strategy.makeQuery() could potentially score (isn't well defined) so instead we call
      // makeFilter() and wrap

      Filter filter = strategy.makeFilter(args);
      if (filter instanceof QueryWrapperFilter) {
        return ((QueryWrapperFilter)filter).getQuery();
      } else {
        return new ConstantScoreQuery(filter);
      }
View Full Code Here

  }

  static Filter getFilter(Query query) {
    if (query instanceof ConstantScoreQuery) {
      ConstantScoreQuery csq = (ConstantScoreQuery) query;
      Filter filter = csq.getFilter();
      if (filter != null) {
        return filter;
      } else {
        return getFilter(csq.getQuery());
      }
View Full Code Here

    }

    for(int i=startIndex;i<clauses.size();i++) {
      BooleanClause clause = clauses.get(i);
      Query queryClause = clause.getQuery();
      Filter filter = getFilter(queryClause);
      if (filter != null) {
        filters.add(filter);
      } else {
        queries.add(queryClause);
      }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.Filter

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.