Tabnine Logo
ConjunctionScorer
Code IndexAdd Tabnine to your IDE (free)

How to use
ConjunctionScorer
in
org.apache.lucene.search

Best Java code snippets using org.apache.lucene.search.ConjunctionScorer (Showing top 20 results out of 315)

origin: org.apache.lucene/lucene-core

 scoringScorers.add(scorer);
return new ConjunctionScorer(weight, requiredScorers, scoringScorers);
origin: org.apache.lucene/lucene-core-jfrog

public boolean skipTo(int target) throws IOException {
 if (firstTime)
  return init(target);
 else if (more)
  more = scorers[(scorers.length-1)].skipTo(target);
 return doNext();
}
origin: lucene/lucene

public boolean next() throws IOException {
 if (firstTime) {
  init();
 } else if (more) {
  more = last().next();                       // trigger further scanning
 }
 return doNext();
}

origin: lucene/lucene

 new ConjunctionScorer(getSimilarity(searcher));
for (int i = 0 ; i < weights.size(); i++) {
 Weight w = (Weight)weights.elementAt(i);
 if (subScorer == null)
  return null;
 result.add(subScorer);
origin: lucene/lucene

public boolean skipTo(int target) throws IOException {
 Iterator i = scorers.iterator();
 while (more && i.hasNext()) {
  more = ((Scorer)i.next()).skipTo(target);
 }
 if (more)
  sortScorers();                              // re-sort scorers
 return doNext();
}
origin: lucene/lucene

private void init() throws IOException {
 more = scorers.size() > 0;
 // compute coord factor
 coord = getSimilarity().coord(scorers.size(), scorers.size());
 // move each scorer to its first entry
 Iterator i = scorers.iterator();
 while (more && i.hasNext()) {
  more = ((Scorer)i.next()).next();
 }
 if (more)
  sortScorers();                              // initial sort of list
 firstTime = false;
}
origin: org.apache.lucene/lucene-core-jfrog

public ConjunctionScorer(Similarity similarity, Scorer[] scorers) throws IOException {
 super(similarity);
 this.scorers = scorers;
 coord = getSimilarity().coord(this.scorers.length, this.scorers.length);
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

doNext();
origin: org.apache.lucene/lucene-core-jfrog

public boolean next() throws IOException {
 if (firstTime)
  return init(0);
 else if (more)
  more = scorers[(scorers.length-1)].next();
 return doNext();
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

public ConjunctionScorer(Similarity similarity, Scorer[] scorers) throws IOException {
 super(similarity);
 this.scorers = scorers;
 coord = getSimilarity().coord(this.scorers.length, this.scorers.length);
}
origin: org.apache.lucene/lucene-core-jfrog

doNext();
origin: org.apache.lucene/lucene-core

@Override
public Scorer get(long leadCost) throws IOException {
 // three cases: conjunction, disjunction, or mix
 leadCost = Math.min(leadCost, cost());
 // pure conjunction
 if (subs.get(Occur.SHOULD).isEmpty()) {
  return excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost);
 }
 // pure disjunction
 if (subs.get(Occur.FILTER).isEmpty() && subs.get(Occur.MUST).isEmpty()) {
  return excl(opt(subs.get(Occur.SHOULD), minShouldMatch, needsScores, leadCost), subs.get(Occur.MUST_NOT), leadCost);
 }
 // conjunction-disjunction mix:
 // we create the required and optional pieces, and then
 // combine the two: if minNrShouldMatch > 0, then it's a conjunction: because the
 // optional side must match. otherwise it's required + optional
 if (minShouldMatch > 0) {
  Scorer req = excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost);
  Scorer opt = opt(subs.get(Occur.SHOULD), minShouldMatch, needsScores, leadCost);
  return new ConjunctionScorer(weight, Arrays.asList(req, opt), Arrays.asList(req, opt));
 } else {
  assert needsScores;
  return new ReqOptSumScorer(
    excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost),
    opt(subs.get(Occur.SHOULD), minShouldMatch, needsScores, leadCost));
 }
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

public boolean next() throws IOException {
 if (firstTime)
  return init(0);
 else if (more)
  more = scorers[(scorers.length-1)].next();
 return doNext();
}
origin: org.apache.lucene/lucene-core-jfrog

private Scorer dualConjunctionSumScorer(Scorer req1, Scorer req2) throws IOException { // non counting.
 return new ConjunctionScorer(defaultSimilarity, new Scorer[]{req1, req2});
 // All scorers match, so defaultSimilarity always has 1 as
 // the coordination factor.
 // Therefore the sum of the scores of two scorers
 // is used as score.
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

public boolean skipTo(int target) throws IOException {
 if (firstTime)
  return init(target);
 else if (more)
  more = scorers[(scorers.length-1)].skipTo(target);
 return doNext();
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

private Scorer dualConjunctionSumScorer(Scorer req1, Scorer req2) throws IOException { // non counting.
 return new ConjunctionScorer(defaultSimilarity, new Scorer[]{req1, req2});
 // All scorers match, so defaultSimilarity always has 1 as
 // the coordination factor.
 // Therefore the sum of the scores of two scorers
 // is used as score.
}
origin: org.apache.lucene/lucene-core-jfrog

private Scorer countingConjunctionSumScorer(List requiredScorers) throws IOException {
 // each scorer from the list counted as a single matcher
 final int requiredNrMatchers = requiredScorers.size();
 return new ConjunctionScorer(defaultSimilarity, requiredScorers) {
  private int lastScoredDoc = -1;
  public float score() throws IOException {
   if (this.doc() >= lastScoredDoc) {
    lastScoredDoc = this.doc();
    coordinator.nrMatchers += requiredNrMatchers;
   }
   // All scorers match, so defaultSimilarity super.score() always has 1 as
   // the coordination factor.
   // Therefore the sum of the scores of the requiredScorers
   // is used as score.
   return super.score();
  }
 };
}
origin: org.apache.lucene/com.springsource.org.apache.lucene

private Scorer countingConjunctionSumScorer(List requiredScorers) throws IOException {
 // each scorer from the list counted as a single matcher
 final int requiredNrMatchers = requiredScorers.size();
 return new ConjunctionScorer(defaultSimilarity, requiredScorers) {
  private int lastScoredDoc = -1;
  public float score() throws IOException {
   if (this.doc() >= lastScoredDoc) {
    lastScoredDoc = this.doc();
    coordinator.nrMatchers += requiredNrMatchers;
   }
   // All scorers match, so defaultSimilarity super.score() always has 1 as
   // the coordination factor.
   // Therefore the sum of the scores of the requiredScorers
   // is used as score.
   return super.score();
  }
 };
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

 scoringScorers.add(scorer);
return new ConjunctionScorer(weight, requiredScorers, scoringScorers);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public Scorer get(long leadCost) throws IOException {
 // three cases: conjunction, disjunction, or mix
 leadCost = Math.min(leadCost, cost());
 // pure conjunction
 if (subs.get(Occur.SHOULD).isEmpty()) {
  return excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost);
 }
 // pure disjunction
 if (subs.get(Occur.FILTER).isEmpty() && subs.get(Occur.MUST).isEmpty()) {
  return excl(opt(subs.get(Occur.SHOULD), minShouldMatch, needsScores, leadCost), subs.get(Occur.MUST_NOT), leadCost);
 }
 // conjunction-disjunction mix:
 // we create the required and optional pieces, and then
 // combine the two: if minNrShouldMatch > 0, then it's a conjunction: because the
 // optional side must match. otherwise it's required + optional
 if (minShouldMatch > 0) {
  Scorer req = excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost);
  Scorer opt = opt(subs.get(Occur.SHOULD), minShouldMatch, needsScores, leadCost);
  return new ConjunctionScorer(weight, Arrays.asList(req, opt), Arrays.asList(req, opt));
 } else {
  assert needsScores;
  return new ReqOptSumScorer(
    excl(req(subs.get(Occur.FILTER), subs.get(Occur.MUST), leadCost), subs.get(Occur.MUST_NOT), leadCost),
    opt(subs.get(Occur.SHOULD), minShouldMatch, needsScores, leadCost));
 }
}
org.apache.lucene.searchConjunctionScorer

Javadoc

Scorer for conjunctions, sets of queries, all of which are required.

Most used methods

  • <init>
    Create a new ConjunctionScorer, note that scorers must be a subset of required.
  • doNext
  • getSimilarity
  • init
  • add
  • first
  • last
  • sortScorers

Popular in Java

  • Updating database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • Menu (java.awt)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now