Package org.apache.lucene.search

Examples of org.apache.lucene.search.ConstantScoreQuery


        SpatialOperation.IsWithin ))
      throw new UnsupportedSpatialOperation(args.getOperation());
    Shape shape = args.getShape();
    if (shape instanceof Rectangle) {
      Rectangle bbox = (Rectangle) shape;
      return new ConstantScoreQuery(makeWithin(bbox));
    } else if (shape instanceof Circle) {
      Circle circle = (Circle)shape;
      Rectangle bbox = circle.getBoundingBox();
      ValueSourceFilter vsf = new ValueSourceFilter(
          new QueryWrapperFilter(makeWithin(bbox)),
          makeDistanceValueSource(circle.getCenter()),
          0,
          circle.getRadius() );
      return new ConstantScoreQuery(vsf);
    } else {
      throw new UnsupportedOperationException("Only Rectangles and Circles are currently supported, " +
          "found [" + shape.getClass() + "]");//TODO
    }
  }
View Full Code Here


        return new SumScoreFacetsAggregator();
      }
    };
    FacetsCollector fc = FacetsCollector.create(fa);
    TopScoreDocCollector topDocs = TopScoreDocCollector.create(10, false);
    ConstantScoreQuery csq = new ConstantScoreQuery(new MatchAllDocsQuery());
    csq.setBoost(2.0f);
   
    newSearcher(r).search(csq, MultiCollector.wrap(fc, topDocs));
   
    List<FacetResult> res = fc.getFacetResults();
    float value = (float) res.get(0).getFacetResultNode().value;
View Full Code Here

      }
      q = bq;
    }
    drillDownDims.put(dim, drillDownDims.size());

    final ConstantScoreQuery drillDownQuery = new ConstantScoreQuery(q);
    drillDownQuery.setBoost(0.0f);
    query.add(drillDownQuery, Occur.MUST);
  }
View Full Code Here

          Math.min(BooleanQuery.getMaxClauseCount(), terms.size()));
      BooleanQuery bq = new BooleanQuery();
      for (int j = 0; j < numTerms; j++) {
        bq.add(new BooleanClause(new TermQuery(terms.get(j)), Occur.SHOULD));
      }
      TopDocs queryResult = searcher.search(new ConstantScoreQuery(bq), reader.maxDoc());
     
      MatchAllDocsQuery matchAll = new MatchAllDocsQuery();
      final TermsFilter filter = termsFilter(singleField, terms.subList(0, numTerms));;
      TopDocs filterResult = searcher.search(matchAll, filter, reader.maxDoc());
      assertEquals(filterResult.totalHits, queryResult.totalHits);
View Full Code Here

   * @see org.apache.lucene.search.Query
   * @see org.hibernate.search.spatial.Coordinates
   * @see org.apache.lucene.search.ConstantScoreQuery
   */
  public static Query buildGridQuery(Point center, double radius, String fieldName) {
    return new ConstantScoreQuery( buildGridFilter( center, radius, fieldName ) );
  }
View Full Code Here

   * @see Query
   * @see org.hibernate.search.spatial.Coordinates
   */
  public static Query buildDistanceQuery(Point center, double radius, String fieldName) {
    Filter allFilter = new QueryWrapperFilter( new MatchAllDocsQuery() );
    return new ConstantScoreQuery( buildDistanceFilter( allFilter, center, radius, fieldName ) );
  }
View Full Code Here

   *
   * @see Query
   * @see org.hibernate.search.spatial.Coordinates
   */
  public static Query buildSpatialQueryByGrid(Point center, double radius, String fieldName) {
    return new ConstantScoreQuery(
        buildDistanceFilter(
            buildGridFilter( center, radius, fieldName ),
            center,
            radius,
            fieldName
View Full Code Here

    BooleanQuery boxQuery = new BooleanQuery();
    boxQuery.add(latQuery, BooleanClause.Occur.MUST);
    boxQuery.add(longQuery, BooleanClause.Occur.MUST);

    return new ConstantScoreQuery(
        buildDistanceFilter(
            new QueryWrapperFilter( boxQuery ),
            center,
            radius,
            latitudeFieldName,
View Full Code Here

    finalQuery.setBoost( boost * finalQuery.getBoost() );
    if ( filter != null ) {
      finalQuery = new FilteredQuery(finalQuery, filter);
    }
    if ( constantScore ) {
      finalQuery = new ConstantScoreQuery( new QueryWrapperFilter( finalQuery ) );
    }
    return finalQuery;
  }
View Full Code Here

        List<Query> filters = rb.getFilters();
        if (filters == null) {
            filters = new ArrayList<Query>();
            rb.setFilters(filters);
        }
        filters.add(new ConstantScoreQuery(filter));
    }
View Full Code Here

TOP

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

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.