trie

Karl Wettin <[email protected]> Sat, 23 Jul 2005 18:35:44 +0200
Newsgroups gmane.comp.java.ozone.user
Message-ID <[email protected]>
Hello list,

I'm working on a small trie (text search index). It could easily be  
made Ozone-aware and allow users to add query-features to their  
applications. It probably does not work too great if used as one  
large index. I.e. store user email-addresses in one index per site,  
user creditcard transaction descriptions in one index per user, and  
so on.

There are two Trie-implementations:

  * SimpleAnalyzer >> associates the whole key with the value, i.e.  
"hello world".
  * SimpleWordBreakingAnalyzer >> associates all words of the key  
with the value, i.e. "hello" and "world".

Node.java can be optimized by adding support for more than one  
character per branch, i.e:

(root node)
   hell -> object 1 & 3
       o -> object 2

rather than
(root node)
   h
    e
     l
      l -> object 1 & 3
       o -> object 2

First I'll refactor the analyzer from the Trie so only the Trie has  
to be Ozone-aware. Then I'll add more analyzers (wildcards, et.c.),  
add features to and optimize the abstract classes, and last I'll make  
an Ozone-aware implementation.

There is no remove-feature yet, so you'll have to rebuild the whole  
trie in that case. I could of course add that as a method, but I  
didn't do that yet.


-- 

   kalle
trie.src.tar.gz (application/x-gzip, 10 KB) - not displayed