Package org.apache.lucene.util.fst
Class Util.TopNSearcher<T>
java.lang.Object
org.apache.lucene.util.fst.Util.TopNSearcher<T>
- Enclosing class:
- Util
Utility class to find top N shortest paths from start point(s).
-
Constructor Summary
ConstructorDescriptionTopNSearcher
(FST<T> fst, int topN, int maxQueueDepth, Comparator<T> comparator) Creates an unbounded TopNSearcherTopNSearcher
(FST<T> fst, int topN, int maxQueueDepth, Comparator<T> comparator, Comparator<Util.FSTPath<T>> pathComparator) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptPartialPath
(Util.FSTPath<T> path) Override this to prevent considering a path before it's completeprotected boolean
acceptResult
(Util.FSTPath<T> path) protected boolean
acceptResult
(IntsRef input, T output) protected void
addIfCompetitive
(Util.FSTPath<T> path) void
addStartPaths
(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input) void
addStartPaths
(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, CharSequence context, int payload) Adds all leaving arcs, including 'finished' arc, if the node is final, from this node into the queue.search()
-
Constructor Details
-
TopNSearcher
Creates an unbounded TopNSearcher- Parameters:
fst
- theFST
to search ontopN
- the number of top scoring entries to retrievemaxQueueDepth
- the maximum size of the queue of possible top entriescomparator
- the comparator to select the top N
-
TopNSearcher
public TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, Comparator<T> comparator, Comparator<Util.FSTPath<T>> pathComparator)
-
-
Method Details
-
addIfCompetitive
-
addStartPaths
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input) throws IOException - Throws:
IOException
-
addStartPaths
public void addStartPaths(FST.Arc<T> node, T startOutput, boolean allowEmptyString, IntsRefBuilder input, float boost, CharSequence context, int payload) throws IOException Adds all leaving arcs, including 'finished' arc, if the node is final, from this node into the queue.- Throws:
IOException
-
search
- Throws:
IOException
-
acceptResult
-
acceptPartialPath
Override this to prevent considering a path before it's complete -
acceptResult
-