org.apache.lucene.util.fst

## Class Util.TopNSearcher<T>

- java.lang.Object
- - org.apache.lucene.util.fst.Util.TopNSearcher<T>

- Enclosing class:
    Util

      public static class Util.TopNSearcher<T>
      extends Object

  Utility class to find top N shortest paths from start point(s).

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Util.TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, Comparator<T> comparator)` Creates an unbounded TopNSearcher
    `Util.TopNSearcher(FST<T> fst, int topN, int maxQueueDepth, Comparator<T> comparator, Comparator<Util.FSTPath<T>> pathComparator)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `acceptResult(IntsRef input, T output)`
    `protected boolean` | `acceptResult(Util.FSTPath<T> path)`
    `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)` Adds all leaving arcs, including 'finished' arc, if the node is final, from this node into the queue.
    `Util.TopResults<T>` | `search()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Util.TopNSearcher

          public Util.TopNSearcher(FST<T> fst,
                           int topN,
                           int maxQueueDepth,
                           Comparator<T> comparator)

      Creates an unbounded TopNSearcher
      Parameters:
        `fst` - the `FST` to search on
        `topN` - the number of top scoring entries to retrieve
        `maxQueueDepth` - the maximum size of the queue of possible top entries
        `comparator` - the comparator to select the top N

    - #### Util.TopNSearcher

          public Util.TopNSearcher(FST<T> fst,
                           int topN,
                           int maxQueueDepth,
                           Comparator<T> comparator,
                           Comparator<Util.FSTPath<T>> pathComparator)

  - ### Method Detail

    - #### addIfCompetitive

          protected void addIfCompetitive(Util.FSTPath<T> path)

    - #### 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)
                             throws IOException

      Adds all leaving arcs, including 'finished' arc, if the node is final, from this node into the queue.
      Throws:
        `IOException`

    - #### search

          public Util.TopResults<T> search()
                                    throws IOException

      Throws:
        `IOException`

    - #### acceptResult

          protected boolean acceptResult(Util.FSTPath<T> path)

    - #### acceptResult

          protected boolean acceptResult(IntsRef input,
                             T output)

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.