Package org.apache.lucene.search.BooleanQuery

Examples of org.apache.lucene.search.BooleanQuery.BooleanWeight


    for (String value : values) {
      bq.add(new TermQuery(new Term("field", value)), BooleanClause.Occur.SHOULD);
    }
    bq.setMinimumNumberShouldMatch(minShouldMatch);

    BooleanWeight weight = (BooleanWeight) searcher.createNormalizedWeight(bq);
   
    if (slow) {
      return new SlowMinShouldMatchScorer(weight, reader, searcher);
    } else {
      return weight.scorer(reader.getContext(), true, false, null);
    }
  }
View Full Code Here


    RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
    writer.commit();
    IndexReader ir = writer.getReader();
    writer.close();
    IndexSearcher searcher = newSearcher(ir);
    BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
    Scorer[] scorers = new Scorer[] {new Scorer(weight) {
      private int doc = -1;
      @Override public float score() { return 0; }
      @Override public int freq()  { return 0; }
      @Override public int docID() { return doc; }
View Full Code Here

    RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
    writer.commit();
    IndexReader ir = writer.getReader();
    writer.close();
    IndexSearcher searcher = newSearcher(ir);
    BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
    Scorer[] scorers = new Scorer[] {new Scorer(weight) {
      private int doc = -1;
      @Override public float score() { return 0; }
      @Override public int freq()  { return 0; }
      @Override public int docID() { return doc; }
View Full Code Here

    for (String value : values) {
      bq.add(new TermQuery(new Term("field", value)), BooleanClause.Occur.SHOULD);
    }
    bq.setMinimumNumberShouldMatch(minShouldMatch);

    BooleanWeight weight = (BooleanWeight) searcher.createNormalizedWeight(bq);
   
    if (slow) {
      return new SlowMinShouldMatchScorer(weight, reader, searcher);
    } else {
      return weight.scorer(reader.getContext(), true, false, null);
    }
  }
View Full Code Here

    RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
    writer.commit();
    IndexReader ir = writer.getReader();
    writer.close();
    IndexSearcher searcher = newSearcher(ir);
    BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
    Scorer[] scorers = new Scorer[] {new Scorer(weight) {
      private int doc = -1;
      @Override public float score() { return 0; }
      @Override public int freq()  { return 0; }
      @Override public int docID() { return doc; }
View Full Code Here

    for (String value : values) {
      bq.add(new TermQuery(new Term("field", value)), BooleanClause.Occur.SHOULD);
    }
    bq.setMinimumNumberShouldMatch(minShouldMatch);

    BooleanWeight weight = (BooleanWeight) searcher.createNormalizedWeight(bq);
   
    if (slow) {
      return new SlowMinShouldMatchScorer(weight, reader, searcher);
    } else {
      return weight.scorer(reader.getContext(), true, false, null);
    }
  }
View Full Code Here

    for (String value : values) {
      bq.add(new TermQuery(new Term("field", value)), BooleanClause.Occur.SHOULD);
    }
    bq.setMinimumNumberShouldMatch(minShouldMatch);

    BooleanWeight weight = (BooleanWeight) searcher.createNormalizedWeight(bq);
   
    if (slow) {
      return new SlowMinShouldMatchScorer(weight, reader, searcher);
    } else {
      return weight.scorer(reader.getContext(), null);
    }
  }
View Full Code Here

    RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
    writer.commit();
    IndexReader ir = writer.getReader();
    writer.close();
    IndexSearcher searcher = newSearcher(ir);
    BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
    BulkScorer[] scorers = new BulkScorer[] {new BulkScorer() {
      private int doc = -1;

      @Override
      public boolean score(Collector c, int maxDoc) throws IOException {
View Full Code Here

    RandomIndexWriter writer = new RandomIndexWriter(random, directory);
    writer.commit();
    IndexReader ir = writer.getReader();
    writer.close();
    IndexSearcher searcher = newSearcher(ir);
    BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
    BooleanScorer bs = new BooleanScorer(weight, false, sim, 1, Arrays.asList(scorers), null, scorers.length);

    final List<Integer> hits = new ArrayList<Integer>();
    bs.score(new Collector() {
      int docBase;
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.BooleanQuery.BooleanWeight

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.