congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
LongValuesSource.getValues
Code IndexAdd Tabnine to your IDE (free)

How to use
getValues
method
in
org.apache.lucene.search.LongValuesSource

Best Java code snippets using org.apache.lucene.search.LongValuesSource.getValues (Showing top 11 results out of 315)

origin: org.apache.lucene/lucene-core

@Override
public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
 LongValues v = inner.getValues(ctx, scores);
 return new DoubleValues() {
  @Override
  public double doubleValue() throws IOException {
   return (double) v.longValue();
  }
  @Override
  public boolean advanceExact(int doc) throws IOException {
   return v.advanceExact(doc);
  }
 };
}
origin: org.apache.lucene/lucene-core

 @Override
 public void setScorer(Scorer scorer) throws IOException {
  holder.values = producer.getValues(ctx, DoubleValuesSource.fromScorer(scorer));
 }
};
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException {
 LongValues v = inner.getValues(ctx, scores);
 return new DoubleValues() {
  @Override
  public double doubleValue() throws IOException {
   return (double) v.longValue();
  }
  @Override
  public boolean advanceExact(int doc) throws IOException {
   return v.advanceExact(doc);
  }
 };
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

 @Override
 public void setScorer(Scorer scorer) throws IOException {
  holder.values = producer.getValues(ctx, DoubleValuesSource.fromScorer(scorer));
 }
};
origin: org.apache.lucene/lucene-sandbox

@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
 Collection<Scorer> scorers = new ArrayList<>();
 for (Weight w : weights) {
  Scorer s = w.scorer(context);
  if (s != null) {
   scorers.add(s);
  }
 }
 if (scorers.isEmpty()) {
  return null;
 }
 return new CoveringScorer(this, scorers, minimumNumberMatch.getValues(context, null), context.reader().maxDoc());
}
origin: org.apache.lucene/lucene-sandbox

@Override
public Matches matches(LeafReaderContext context, int doc) throws IOException {
 LongValues minMatchValues = minimumNumberMatch.getValues(context, null);
 if (minMatchValues.advanceExact(doc) == false) {
  return null;
 }
 final long minimumNumberMatch = Math.max(1, minMatchValues.longValue());
 long matchCount = 0;
 List<Matches> subMatches = new ArrayList<>();
 for (Weight weight : weights) {
  Matches matches = weight.matches(context, doc);
  if (matches != null) {
   matchCount++;
   subMatches.add(matches);
  }
 }
 if (matchCount < minimumNumberMatch) {
  return null;
 }
 return MatchesUtils.fromSubMatches(subMatches);
}
origin: org.apache.lucene/lucene-sandbox

@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
 LongValues minMatchValues = minimumNumberMatch.getValues(context, null);
 if (minMatchValues.advanceExact(doc) == false) {
  return Explanation.noMatch("minimumNumberMatch has no value on the current document");
 }
 final long minimumNumberMatch = Math.max(1, minMatchValues.longValue());
 int freq = 0;
 double score = 0;
 List<Explanation> subExpls = new ArrayList<>();
 for (Weight weight : weights) {
  Explanation subExpl = weight.explain(context, doc);
  if (subExpl.isMatch()) {
   freq++;
   score += subExpl.getValue();
  }
  subExpls.add(subExpl);
 }
 if (freq >= minimumNumberMatch) {
  return Explanation.match((float) score, freq + " matches for " + minimumNumberMatch + " required matches, sum of:", subExpls);
 } else {
  return Explanation.noMatch(freq + " matches for " + minimumNumberMatch + " required matches", subExpls);
 }
}
origin: org.apache.lucene/lucene-facet

private void countAll(LongValuesSource valueSource, String field, IndexReader reader) throws IOException {
 for (LeafReaderContext context : reader.leaves()) {
  LongValues fv = valueSource.getValues(context, null);
  int maxDoc = context.reader().maxDoc();
  for (int doc = 0; doc < maxDoc; doc++) {
   // Skip missing docs:
   if (fv.advanceExact(doc)) {
    increment(fv.longValue());
    totCount++;
   }
  }
 }
}

origin: org.apache.lucene/lucene-facet

private void count(LongValuesSource valueSource, List<MatchingDocs> matchingDocs) throws IOException {
 for (MatchingDocs hits : matchingDocs) {
  LongValues fv = valueSource.getValues(hits.context, null);
  // NOTE: this is not as efficient as working directly with the doc values APIs in the sparse case
  // because we are doing a linear scan across all hits, but this API is more flexible since a
  // LongValuesSource can compute interesting values at query time
  DocIdSetIterator docs = hits.bits.iterator();
  for (int doc = docs.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS;) {
   // Skip missing docs:
   if (fv.advanceExact(doc)) {
    increment(fv.longValue());
    totCount++;
   }
   doc = docs.nextDoc();
  }
 }
}
origin: org.apache.lucene/lucene-facet

@Override
public Scorer scorer(LeafReaderContext context) throws IOException {
 final int maxDoc = context.reader().maxDoc();
 final DocIdSetIterator approximation;
 if (fastMatchWeight == null) {
  approximation = DocIdSetIterator.all(maxDoc);
 } else {
  Scorer s = fastMatchWeight.scorer(context);
  if (s == null) {
   return null;
  }
  approximation = s.iterator();
 }
 final LongValues values = valueSource.getValues(context, null);
 final TwoPhaseIterator twoPhase = new TwoPhaseIterator(approximation) {
  @Override
  public boolean matches() throws IOException {
   return values.advanceExact(approximation.docID()) && range.accept(values.longValue());
  }
  @Override
  public float matchCost() {
   return 100; // TODO: use cost of range.accept()
  }
 };
 return new ConstantScoreScorer(this, score(), twoPhase);
}
origin: org.apache.lucene/lucene-facet

LongValues fv = valueSource.getValues(hits.context, null);
org.apache.lucene.searchLongValuesSourcegetValues

Javadoc

Returns a LongValues instance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (ie #needsScores(), callers may safely pass null for the scores parameter.

Popular methods of LongValuesSource

  • isCacheable
  • fromLongField
    Creates a LongValuesSource that wraps a long-valued field
  • needsScores
    Return true if document scores are needed to calculate values
  • rewrite
    Return a LongValuesSource specialised for the given IndexSearcher Implementations should assume that
  • toString
  • fromIntField
    Creates a LongValuesSource that wraps an int-valued field
  • toDoubleValuesSource
    Convert to a DoubleValuesSource by casting long values to doubles
  • equals
  • hashCode

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for Android Studio
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