Tabnine Logo
BytesRef.deepCopyOf
Code IndexAdd Tabnine to your IDE (free)

How to use
deepCopyOf
method
in
org.apache.lucene.util.BytesRef

Best Java code snippets using org.apache.lucene.util.BytesRef.deepCopyOf (Showing top 20 results out of 315)

origin: org.apache.lucene/lucene-core

@Override
public void copyTo(AttributeImpl target) {
 BytesTermAttributeImpl other = (BytesTermAttributeImpl) target;
 other.bytes = bytes == null ? null : BytesRef.deepCopyOf(bytes);
}
origin: org.apache.lucene/lucene-core

/** Constructs a Term with the given field and bytes.
 * <p>Note that a null field or null bytes value results in undefined
 * behavior for most Lucene APIs that accept a Term parameter.
 *
 * <p>The provided BytesRef is copied when it is non null.
 */
public Term(String fld, BytesRef bytes) {
 field = fld;
 this.bytes = bytes == null ? null : BytesRef.deepCopyOf(bytes);
}
origin: org.apache.lucene/lucene-core

private boolean setSavedStartTerm(BytesRef startTerm) {
 savedStartTerm = startTerm == null ? null : BytesRef.deepCopyOf(startTerm);
 return true;
}
origin: org.apache.lucene/lucene-core

/**
 * Gets an integer id for a given term and saves the position increment if needed.
 */
private int getTermID(int incr, int prevIncr, BytesRef term) {
 assert term != null;
 boolean isStackedGap = incr == 0 && prevIncr > 1;
 int id = idToTerm.size();
 idToTerm.put(id, BytesRef.deepCopyOf(term));
 // stacked token should have the same increment as original token at this position
 if (isStackedGap) {
  idToInc.put(id, prevIncr);
 } else if (incr > 1) {
  idToInc.put(id, incr);
 }
 return id;
}
origin: org.apache.lucene/lucene-core

@Override
public PayloadAttributeImpl clone()  {
 PayloadAttributeImpl clone = (PayloadAttributeImpl) super.clone();
 if (payload != null) {
  clone.payload = BytesRef.deepCopyOf(payload);
 }
 return clone;
}
origin: org.apache.lucene/lucene-core

@Override
public void copyTo(AttributeImpl target) {
 PayloadAttribute t = (PayloadAttribute) target;
 t.setPayload((payload == null) ? null : BytesRef.deepCopyOf(payload));
}  
origin: org.apache.lucene/lucene-core

 TermAndState(String field, TermsEnum termsEnum) throws IOException {
  this.field = field;
  this.termsEnum = termsEnum;
  this.term = BytesRef.deepCopyOf(termsEnum.term());
  this.state = termsEnum.termState();
  this.docFreq = termsEnum.docFreq();
  this.totalTermFreq = termsEnum.totalTermFreq();
 }
}
origin: org.apache.lucene/lucene-core

   + this + " and input \"" + text + "\"");
final BytesRef term = BytesRef.deepCopyOf(termAtt.getBytesRef());
if (ts.incrementToken()) {
 throw new IllegalStateException("The normalization token stream is "
origin: org.apache.lucene/lucene-core

/** Try to collect terms from the given terms enum and return true iff all
 *  terms could be collected. If {@code false} is returned, the enum is
 *  left positioned on the next term. */
private boolean collectTerms(LeafReaderContext context, TermsEnum termsEnum, List<TermAndState> terms) throws IOException {
 final int threshold = Math.min(BOOLEAN_REWRITE_TERM_COUNT_THRESHOLD, BooleanQuery.getMaxClauseCount());
 for (int i = 0; i < threshold; ++i) {
  final BytesRef term = termsEnum.next();
  if (term == null) {
   return true;
  }
  TermState state = termsEnum.termState();
  terms.add(new TermAndState(BytesRef.deepCopyOf(term), state, termsEnum.docFreq(), termsEnum.totalTermFreq()));
 }
 return termsEnum.next() == null;
}
origin: org.apache.lucene/lucene-core

@Override
public Query rewrite(IndexReader reader) throws IOException {
 final int threshold = Math.min(BOOLEAN_REWRITE_TERM_COUNT_THRESHOLD, BooleanQuery.getMaxClauseCount());
 if (termData.size() <= threshold) {
  BooleanQuery.Builder bq = new BooleanQuery.Builder();
  TermIterator iterator = termData.iterator();
  for (BytesRef term = iterator.next(); term != null; term = iterator.next()) {
   bq.add(new TermQuery(new Term(iterator.field(), BytesRef.deepCopyOf(term))), Occur.SHOULD);
  }
  return new ConstantScoreQuery(bq.build());
 }
 return super.rewrite(reader);
}
origin: org.apache.lucene/lucene-core

lastValue = BytesRef.deepCopyOf(term);
origin: org.apache.lucene/lucene-core

termBounds.add(BytesRef.deepCopyOf(term));
lastTermAdded = termCount;
if (termBounds.size() == 5) {
origin: org.apache.lucene/lucene-core

private SortingLeafReader.CachedBinaryDVs sortDocValues(int maxDoc, Sorter.DocMap sortMap, BinaryDocValues oldValues) throws IOException {
 FixedBitSet docsWithField = new FixedBitSet(maxDoc);
 BytesRef[] values = new BytesRef[maxDoc];
 while (true) {
  int docID = oldValues.nextDoc();
  if (docID == NO_MORE_DOCS) {
   break;
  }
  int newDocID = sortMap.oldToNew(docID);
  docsWithField.set(newDocID);
  values[newDocID] = BytesRef.deepCopyOf(oldValues.binaryValue());
 }
 return new SortingLeafReader.CachedBinaryDVs(values, docsWithField);
}
origin: org.apache.lucene/lucene-core

lastValue = BytesRef.deepCopyOf(term);
origin: org.apache.lucene/lucene-core

@Override
public BinaryDocValues getBinaryDocValues(String field) throws IOException {
 final BinaryDocValues oldDocValues = in.getBinaryDocValues(field);
 if (oldDocValues == null) return null;
 CachedBinaryDVs dvs;
 synchronized (cachedBinaryDVs) {
  dvs = cachedBinaryDVs.get(field);
  if (dvs == null) {
   FixedBitSet docsWithField = new FixedBitSet(maxDoc());
   BytesRef[] values = new BytesRef[maxDoc()];
   while (true) {
    int docID = oldDocValues.nextDoc();
    if (docID == NO_MORE_DOCS) {
     break;
    }
    int newDocID = docMap.oldToNew(docID);
    docsWithField.set(newDocID);
    values[newDocID] = BytesRef.deepCopyOf(oldDocValues.binaryValue());
   }
   dvs = new CachedBinaryDVs(values, docsWithField);
   cachedBinaryDVs.put(field, dvs);
  }
 }
 return new SortingBinaryDocValues(dvs);
}

origin: org.apache.lucene/lucene-core

queuedBottom = BytesRef.deepCopyOf(term);
origin: org.apache.lucene/lucene-core

if (bb != null) {
 assert bb.isValid();
 minTerm = BytesRef.deepCopyOf(bb);
} else {
 minTerm = null;
if (bb != null) {
 assert bb.isValid();
 maxTerm = BytesRef.deepCopyOf(bb);
 if (minTerm == null) {
  throw new RuntimeException("field \"" + field + "\" has null minTerm but non-null maxTerm");
    throw new RuntimeException("seek to ord " + ord + " returned ord " + actualOrd);
   seekTerms[i] = BytesRef.deepCopyOf(termsEnum.term());
origin: org.elasticsearch/elasticsearch

/**
 * Returns a compact array from the given BytesReference. The returned array won't be copied unless necessary. If you need
 * to modify the returned array use {@code BytesRef.deepCopyOf(reference.toBytesRef()} instead
 */
public static byte[] toBytes(BytesReference reference) {
  final BytesRef bytesRef = reference.toBytesRef();
  if (bytesRef.offset == 0 && bytesRef.length == bytesRef.bytes.length) {
    return bytesRef.bytes;
  }
  return BytesRef.deepCopyOf(bytesRef).bytes;
}
origin: org.elasticsearch/elasticsearch

@Override
public BytesRef copyValue() {
  BytesRef value = currentValue();
  if (value == null) {
    return null;
  } else {
    return BytesRef.deepCopyOf(value);
  }
}
origin: org.elasticsearch/elasticsearch

  @Override
  public void nextToken() {
    Term term = new Term(field, BytesRef.deepCopyOf(fillBytesRef(new BytesRefBuilder())));
    result.add(new Token(term, offsetAttr.startOffset(), offsetAttr.endOffset()));
  }
}, spare);
org.apache.lucene.utilBytesRefdeepCopyOf

Javadoc

Creates a new BytesRef that points to a copy of the bytes from other

The returned BytesRef will have a length of other.length and an offset of zero.

Popular methods of BytesRef

  • <init>
    This instance will directly reference bytes w/o making a copy. bytes should not be null.
  • utf8ToString
    Interprets stored bytes as UTF8 bytes, returning the resulting string
  • compareTo
    Unsigned byte order comparison
  • equals
  • hashCode
    Calculates the hash code as required by TermsHash during indexing. This is currently implemented as
  • bytesEquals
    Expert: compares the bytes against another BytesRef, returning true if the bytes are equal.
  • toString
    Returns hex encoded bytes, eg [0x6c 0x75 0x63 0x65 0x6e 0x65]
  • clone
    Returns a shallow clone of this instance (the underlying bytes arenot copied and will be shared by b
  • getUTF8SortedAsUnicodeComparator
  • copyBytes
  • isValid
    Performs internal consistency checks. Always returns true (or throws IllegalStateException)
  • append
  • isValid,
  • append,
  • copyChars,
  • getUTF8SortedAsUTF16Comparator,
  • grow,
  • length,
  • array,
  • compareNumberTo,
  • duplicate

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getContentResolver (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • 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