Re: trie

Per Nyfelt <[email protected]> Mon, 25 Jul 2005 19:18:16 +0200
Newsgroups gmane.comp.java.ozone.user
Organization New Field Consulting
Message-ID <[email protected]>
Hi Karl,

Very interesting. Have you looked at JXPath from apache commons? I've used it 
as a query language on some occations. It works great with Ozone but is a 
little slow for huge collections. If my objects have accessors and mutators 
and i can traverse collections of them with XPath. I used JXPath for the 
Petstore implementation i just finished and will check into OzoneApps soon. 
E.g. lets say I have a Petstore Catalog with Products who in turn has Items i 
can get all items that are birds by the xpath

categories[categoryId='BIRDS']/products/items

or names of the products by the xpath

categories/products/name

What would be really nice if there would be a way to annotate the property of 
the OzoneObject that you would want to index so that OPP (or whatever) would 
take care of generating an index search so that a query for all female dogs 
and cats which would look like this:

categories[name='Dogs' or 
name='Cats']/products/items[contains(description,'Female')]

would be significantly speeded up if Category.name and Item.description would 
be indexed. An alternative to jxpath would be a SODA implementation 
(http://sourceforge.net/projects/sodaquery/) but indexable and queryable 
collections would still be the foundation for that. 

How would you compare your efforts with Lucene which is quite a full featured 
indexing and search engine?

Best regards,
Per

Saturday 23 July 2005 18.35 skrev Karl Wettin:
> 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.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click