congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.apache.lucene.util.fst
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.lucene.util.fst

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

origin: org.apache.lucene/lucene-core

 private void append(Builder<BytesRef> builder, FST<BytesRef> subIndex, IntsRefBuilder scratchIntsRef) throws IOException {
  final BytesRefFSTEnum<BytesRef> subIndexEnum = new BytesRefFSTEnum<>(subIndex);
  BytesRefFSTEnum.InputOutput<BytesRef> indexEnt;
  while((indexEnt = subIndexEnum.next()) != null) {
   //if (DEBUG) {
   //  System.out.println("      add sub=" + indexEnt.input + " " + indexEnt.input + " output=" + indexEnt.output);
   //}
   builder.add(Util.toIntsRef(indexEnt.input, scratchIntsRef), indexEnt.output);
  }
 }
}
origin: org.apache.lucene/lucene-core

@Override
public Pair<A,B> subtract(Pair<A,B> output, Pair<A,B> inc) {
 assert valid(output);
 assert valid(inc);
 return newPair(outputs1.subtract(output.output1, inc.output1),
         outputs2.subtract(output.output2, inc.output2));
}
origin: org.apache.lucene/lucene-core

/** doFloor controls the behavior of advance: if it's true
 *  doFloor is true, advance positions to the biggest
 *  term before target.  */
protected FSTEnum(FST<T> fst) {
 this.fst = fst;
 fstReader = fst.getBytesReader();
 NO_OUTPUT = fst.outputs.getNoOutput();
 fst.getFirstArc(getArc(0));
 output[0] = NO_OUTPUT;
}
origin: org.apache.lucene/lucene-core

private void pushLast() throws IOException {
 FST.Arc<T> arc = arcs[upto];
 assert arc != null;
 while (true) {
  setCurrentLabel(arc.label);
  output[upto] = fst.outputs.add(output[upto-1], arc.output);
  if (arc.label == FST.END_LABEL) {
   // Final node
   break;
  }
  incr();
  arc = fst.readLastTargetArc(arc, getArc(upto), fstReader);
 }
}
origin: org.apache.lucene/lucene-core

@Override
public Pair<A,B> add(Pair<A,B> prefix, Pair<A,B> output) {
 assert valid(prefix);
 assert valid(output);
 return newPair(outputs1.add(prefix.output1, output.output1),
         outputs2.add(prefix.output2, output.output2));
}
origin: org.apache.lucene/lucene-core

public PairOutputs(Outputs<A> outputs1, Outputs<B> outputs2) {
 this.outputs1 = outputs1;
 this.outputs2 = outputs2;
 NO_OUTPUT = new Pair<>(outputs1.getNoOutput(), outputs2.getNoOutput());
}
origin: org.apache.lucene/lucene-core

@Override
public Pair<A,B> common(Pair<A,B> pair1, Pair<A,B> pair2) {
 assert valid(pair1);
 assert valid(pair2);
 return newPair(outputs1.common(pair1.output1, pair2.output1),
         outputs2.common(pair1.output2, pair2.output2));
}
origin: org.apache.lucene/lucene-core

/**
 * Checks if <code>arc</code>'s target state is in expanded (or vector) format. 
 * 
 * @return Returns <code>true</code> if <code>arc</code> points to a state in an
 * expanded array format.
 */
boolean isExpandedTarget(Arc<T> follow, BytesReader in) throws IOException {
 if (!targetHasArcs(follow)) {
  return false;
 } else {
  in.setPosition(follow.target);
  return in.readByte() == ARCS_AS_FIXED_ARRAY;
 }
}
origin: org.apache.lucene/lucene-core

@Override
public Pair<A,B> read(DataInput in) throws IOException {
 A output1 = outputs1.read(in);
 B output2 = outputs2.read(in);
 return newPair(output1, output2);
}

origin: org.apache.lucene/lucene-core

@Override
public void write(Pair<A,B> output, DataOutput writer) throws IOException {
 assert valid(output);
 outputs1.write(output.output1, writer);
 outputs2.write(output.output2, writer);
}
origin: org.apache.lucene/lucene-core

@Override
public String outputToString(Pair<A,B> output) {
 assert valid(output);
 return "<pair:" + outputs1.outputToString(output.output1) + "," + outputs2.outputToString(output.output2) + ">";
}
origin: org.apache.lucene/lucene-core

/** Seeks to biggest term that's &lt;= target. */
public InputOutput<T> seekFloor(IntsRef target) throws IOException {
 this.target = target;
 targetLength = target.length;
 super.doSeekFloor();
 return setResult();
}
origin: org.apache.lucene/lucene-core

/** Seeks to biggest term that's &lt;= target. */
public InputOutput<T> seekFloor(BytesRef target) throws IOException {
 this.target = target;
 targetLength = target.length;
 super.doSeekFloor();
 return setResult();
}
origin: org.apache.lucene/lucene-core

/** Seeks to smallest term that's &gt;= target. */
public InputOutput<T> seekCeil(IntsRef target) throws IOException {
 this.target = target;
 targetLength = target.length;
 super.doSeekCeil();
 return setResult();
}
origin: org.apache.lucene/lucene-core

/** Seeks to smallest term that's &gt;= target. */
public InputOutput<T> seekCeil(BytesRef target) throws IOException {
 this.target = target;
 targetLength = target.length;
 super.doSeekCeil();
 return setResult();
}
origin: org.apache.lucene/lucene-core

/** Returns a {@link BytesReader} for this FST, positioned at
 *  position 0. */
public BytesReader getBytesReader() {
 if (bytesArray != null) {
  return new ReverseBytesReader(bytesArray);
 } else {
  return bytes.getReverseReader();
 }
}
origin: org.apache.lucene/lucene-core

FST(INPUT_TYPE inputType, Outputs<T> outputs, int bytesPageBits) {
 this.inputType = inputType;
 this.outputs = outputs;
 version = VERSION_CURRENT;
 bytesArray = null;
 bytes = new BytesStore(bytesPageBits);
 // pad: ensure no node gets address 0 which is reserved to mean
 // the stop state w/ no arcs
 bytes.writeByte((byte) 0);
 emptyOutput = null;
}
origin: org.apache.lucene/lucene-core

 @Override
 public long ramBytesUsed(Pair<A,B> output) {
  long ramBytesUsed = BASE_NUM_BYTES;
  if (output.output1 != null) {
   ramBytesUsed += outputs1.ramBytesUsed(output.output1);
  }
  if (output.output2 != null) {
   ramBytesUsed += outputs2.ramBytesUsed(output.output2);
  }
  return ramBytesUsed;
 }
}
origin: org.apache.lucene/lucene-core

/**
 * Creates an unbounded TopNSearcher
 * @param fst the {@link org.apache.lucene.util.fst.FST} to search on
 * @param topN the number of top scoring entries to retrieve
 * @param maxQueueDepth the maximum size of the queue of possible top entries
 * @param comparator the comparator to select the top N
 */
public TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, Comparator<T> comparator) {
 this(fst, topN, maxQueueDepth, comparator, new TieBreakByInputComparator<>(comparator));
}
origin: org.apache.lucene/lucene-core

@Override
public Long add(Long prefix, Long output) {
 assert valid(prefix);
 assert valid(output);
 if (prefix == NO_OUTPUT) {
  return output;
 } else if (output == NO_OUTPUT) {
  return prefix;
 } else {
  return prefix + output;
 }
}
org.apache.lucene.util.fst

Most used classes

  • FST
    Represents an finite state machine (FST), using a compact byte[] format. The format is similar to wh
  • FST$Arc
    Represents a single arc.
  • Builder
    Builds a minimal FST (maps an IntsRef term to an arbitrary output) from pre-sorted terms with output
  • Outputs
    Represents the outputs for an FST, providing the basic algebra required for building and traversing
  • Util
    Static helper methods.
  • ByteSequenceOutputs,
  • PairOutputs,
  • Util$TopNSearcher,
  • BytesRefFSTEnum,
  • FST$BytesReader,
  • Builder$Arc,
  • Builder$CompiledNode,
  • Builder$Node,
  • Builder$UnCompiledNode,
  • BytesStore$1,
  • BytesStore$2,
  • BytesStore,
  • FSTEnum,
  • ForwardBytesReader
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