Tabnine Logo
Terms.hasPayloads
Code IndexAdd Tabnine to your IDE (free)

How to use
hasPayloads
method
in
org.apache.lucene.index.Terms

Best Java code snippets using org.apache.lucene.index.Terms.hasPayloads (Showing top 20 results out of 315)

origin: org.apache.lucene/lucene-core

@Override
public boolean hasPayloads() {
 return in.hasPayloads();
}
origin: org.apache.lucene/lucene-core

/** Sole constructor.
 *
 * @param subs The {@link Terms} instances of all sub-readers. 
 * @param subSlices A parallel array (matching {@code
 *        subs}) describing the sub-reader slices.
 */
public MultiTerms(Terms[] subs, ReaderSlice[] subSlices) throws IOException {
 this.subs = subs;
 this.subSlices = subSlices;
 
 assert subs.length > 0 : "inefficient: don't use MultiTerms over one sub";
 boolean _hasFreqs = true;
 boolean _hasOffsets = true;
 boolean _hasPositions = true;
 boolean _hasPayloads = false;
 for(int i=0;i<subs.length;i++) {
  _hasFreqs &= subs[i].hasFreqs();
  _hasOffsets &= subs[i].hasOffsets();
  _hasPositions &= subs[i].hasPositions();
  _hasPayloads |= subs[i].hasPayloads();
 }
 hasFreqs = _hasFreqs;
 hasOffsets = _hasOffsets;
 hasPositions = _hasPositions;
 hasPayloads = hasPositions && _hasPayloads; // if all subs have pos, and at least one has payloads.
}
origin: org.apache.lucene/lucene-core

final boolean hasPayloads = terms.hasPayloads();
final boolean hasOffsets = terms.hasOffsets();
origin: org.apache.lucene/lucene-core

final boolean postingsHasFreq = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
final boolean postingsHasPayload = fieldInfo.hasPayloads();
final boolean vectorsHasPayload = terms.hasPayloads();
origin: org.apache.lucene/lucene-core

final boolean hasPayloads = terms.hasPayloads();
assert !hasPayloads || hasPositions;
origin: org.apache.lucene/lucene-core

final boolean hasPayloads = terms.hasPayloads();
assert !hasPayloads || hasPositions;
origin: org.elasticsearch/elasticsearch

@Override
public Query rewrite(IndexReader reader) throws IOException {
  Query rewritten = super.rewrite(reader);
  if (rewritten != this) {
    return rewritten;
  }
  boolean hasPayloads = false;
  for (LeafReaderContext context : reader.leaves()) {
    final Terms terms = context.reader().terms(term.field());
    if (terms != null) {
      if (terms.hasPayloads()) {
        hasPayloads = true;
        break;
      }
    }
  }
  // if the terms does not exist we could return a MatchNoDocsQuery but this would break the unified highlighter
  // which rewrites query with an empty reader.
  if (hasPayloads == false) {
    return new TermQuery(term);
  }
  return this;
}
origin: org.elasticsearch/elasticsearch

private void initMemory(Terms curTerms, int termFreq) {
  // init memory for performance reasons
  if (curTerms.hasPositions()) {
    currentPositions = ArrayUtil.grow(currentPositions, termFreq);
  }
  if (curTerms.hasOffsets()) {
    currentStartOffset = ArrayUtil.grow(currentStartOffset, termFreq);
    currentEndOffset = ArrayUtil.grow(currentEndOffset, termFreq);
  }
  if (curTerms.hasPayloads()) {
    currentPayloads = new BytesArray[termFreq];
  }
}
origin: org.elasticsearch/elasticsearch

private void buildValues(XContentBuilder builder, Terms curTerms, int termFreq) throws IOException {
  if (!(curTerms.hasPayloads() || curTerms.hasOffsets() || curTerms.hasPositions())) {
    return;
  }
  builder.startArray(FieldStrings.TOKENS);
  for (int i = 0; i < termFreq; i++) {
    builder.startObject();
    if (curTerms.hasPositions()) {
      builder.field(FieldStrings.POS, currentPositions[i]);
    }
    if (curTerms.hasOffsets()) {
      builder.field(FieldStrings.START_OFFSET, currentStartOffset[i]);
      builder.field(FieldStrings.END_OFFSET, currentEndOffset[i]);
    }
    if (curTerms.hasPayloads() && (currentPayloads[i].length() > 0)) {
      BytesRef bytesRef = currentPayloads[i].toBytesRef();
      builder.field(FieldStrings.PAYLOAD, bytesRef.bytes, bytesRef.offset, bytesRef.length);
    }
    builder.endObject();
  }
  builder.endArray();
}
origin: org.elasticsearch/elasticsearch

private void initValues(Terms curTerms, PostingsEnum posEnum, int termFreq) throws IOException {
  for (int j = 0; j < termFreq; j++) {
    int nextPos = posEnum.nextPosition();
    if (curTerms.hasPositions()) {
      currentPositions[j] = nextPos;
    }
    if (curTerms.hasOffsets()) {
      currentStartOffset[j] = posEnum.startOffset();
      currentEndOffset[j] = posEnum.endOffset();
    }
    if (curTerms.hasPayloads()) {
      BytesRef curPayload = posEnum.getPayload();
      if (curPayload != null) {
        currentPayloads[j] = new BytesArray(curPayload.bytes, 0, curPayload.length);
      } else {
        currentPayloads[j] = null;
      }
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public boolean hasPayloads() {
 return in.hasPayloads();
}
origin: harbby/presto-connectors

@Override
public boolean hasPayloads() {
 return in.hasPayloads();
}
origin: org.apache.lucene/lucene-codecs

@Override
public boolean hasPayloads() {
 return delegateTerms.hasPayloads();
}
origin: org.infinispan/infinispan-embedded-query

@Override
public boolean hasPayloads() {
 return in.hasPayloads();
}
origin: org.elasticsearch/elasticsearch

boolean positions = flags.contains(Flag.Positions) && fieldTermVector.hasPositions();
boolean offsets = flags.contains(Flag.Offsets) && fieldTermVector.hasOffsets();
boolean payloads = flags.contains(Flag.Payloads) && fieldTermVector.hasPayloads();
origin: harbby/presto-connectors

private void initMemory(Terms curTerms, int termFreq) {
  // init memory for performance reasons
  if (curTerms.hasPositions()) {
    currentPositions = ArrayUtil.grow(currentPositions, termFreq);
  }
  if (curTerms.hasOffsets()) {
    currentStartOffset = ArrayUtil.grow(currentStartOffset, termFreq);
    currentEndOffset = ArrayUtil.grow(currentEndOffset, termFreq);
  }
  if (curTerms.hasPayloads()) {
    currentPayloads = new BytesArray[termFreq];
  }
}
origin: com.strapdata.elasticsearch/elasticsearch

private void initMemory(Terms curTerms, int termFreq) {
  // init memory for performance reasons
  if (curTerms.hasPositions()) {
    currentPositions = ArrayUtil.grow(currentPositions, termFreq);
  }
  if (curTerms.hasOffsets()) {
    currentStartOffset = ArrayUtil.grow(currentStartOffset, termFreq);
    currentEndOffset = ArrayUtil.grow(currentEndOffset, termFreq);
  }
  if (curTerms.hasPayloads()) {
    currentPayloads = new BytesArray[termFreq];
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void initMemory(Terms curTerms, int termFreq) {
  // init memory for performance reasons
  if (curTerms.hasPositions()) {
    currentPositions = ArrayUtil.grow(currentPositions, termFreq);
  }
  if (curTerms.hasOffsets()) {
    currentStartOffset = ArrayUtil.grow(currentStartOffset, termFreq);
    currentEndOffset = ArrayUtil.grow(currentEndOffset, termFreq);
  }
  if (curTerms.hasPayloads()) {
    currentPayloads = new BytesArray[termFreq];
  }
}
origin: apache/servicemix-bundles

private void initMemory(Terms curTerms, int termFreq) {
  // init memory for performance reasons
  if (curTerms.hasPositions()) {
    currentPositions = ArrayUtil.grow(currentPositions, termFreq);
  }
  if (curTerms.hasOffsets()) {
    currentStartOffset = ArrayUtil.grow(currentStartOffset, termFreq);
    currentEndOffset = ArrayUtil.grow(currentEndOffset, termFreq);
  }
  if (curTerms.hasPayloads()) {
    currentPayloads = new BytesArray[termFreq];
  }
}
origin: apache/servicemix-bundles

private void initValues(Terms curTerms, PostingsEnum posEnum, int termFreq) throws IOException {
  for (int j = 0; j < termFreq; j++) {
    int nextPos = posEnum.nextPosition();
    if (curTerms.hasPositions()) {
      currentPositions[j] = nextPos;
    }
    if (curTerms.hasOffsets()) {
      currentStartOffset[j] = posEnum.startOffset();
      currentEndOffset[j] = posEnum.endOffset();
    }
    if (curTerms.hasPayloads()) {
      BytesRef curPayload = posEnum.getPayload();
      if (curPayload != null) {
        currentPayloads[j] = new BytesArray(curPayload.bytes, 0, curPayload.length);
      } else {
        currentPayloads[j] = null;
      }
    }
  }
}
org.apache.lucene.indexTermshasPayloads

Javadoc

Returns true if documents in this field store payloads.

Popular methods of Terms

  • iterator
  • size
    Returns the number of terms for this field, or -1 if this measure isn't stored by the codec. Note th
  • getSumTotalTermFreq
    Returns the sum of TermsEnum#totalTermFreq for all terms in this field, or -1 if this measure isn't
  • hasPositions
    Returns true if documents in this field store positions.
  • getDocCount
    Returns the number of documents that have at least one term for this field, or -1 if this measure is
  • getSumDocFreq
    Returns the sum of TermsEnum#docFreq() for all terms in this field, or -1 if this measure isn't stor
  • hasOffsets
    Returns true if documents in this field store offsets.
  • getMax
    Returns the largest term (in lexicographic order) in the field. Note that, just like other term meas
  • getMin
    Returns the smallest term (in lexicographic order) in the field. Note that, just like other term mea
  • intersect
    Returns a TermsEnum that iterates over all terms and documents that are accepted by the provided Com
  • hasFreqs
    Returns true if documents in this field store per-document term frequency ( PostingsEnum#freq).
  • getStats
    Expert: returns additional information about this Terms instance for debugging purposes.
  • hasFreqs,
  • getStats

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Notification (javax.management)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • CodeWhisperer alternatives
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