|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.search.suggest.tst.TSTAutocomplete
public class TSTAutocomplete
Ternary Search Trie implementation.
TernaryTreeNode
Method Summary | |
---|---|
void |
balancedTree(Object[] tokens,
Object[] vals,
int lo,
int hi,
TernaryTreeNode root)
Inserting keys in TST in the order middle,small,big (lexicographic measure) recursively creates a balanced tree which reduces insertion and search times significantly. |
TernaryTreeNode |
insert(TernaryTreeNode currentNode,
CharSequence s,
Object val,
int x)
Inserts a key in TST creating a series of Binary Search Trees at each node. |
ArrayList<TernaryTreeNode> |
prefixCompletion(TernaryTreeNode root,
CharSequence s,
int x)
Auto-completes a given prefix query using Depth-First Search with the end of prefix as source node each time finding a new leaf to get a complete key to be added in the suggest list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void balancedTree(Object[] tokens, Object[] vals, int lo, int hi, TernaryTreeNode root)
tokens
- Sorted list of keys to be inserted in TST.lo
- stores the lower index of current list.hi
- stores the higher index of current list.root
- a reference object to root of TST.public TernaryTreeNode insert(TernaryTreeNode currentNode, CharSequence s, Object val, int x)
currentNode
- a reference node where the insertion will take currently.s
- key to be inserted in TST.x
- index of character in key to be inserted currently.
public ArrayList<TernaryTreeNode> prefixCompletion(TernaryTreeNode root, CharSequence s, int x)
root
- a reference to root node of TST.s
- prefix query to be auto-completed.x
- index of current character to be searched while traversing through
the prefix in TST.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |