The moose likes Other Open Source Projects and the fly likes Lucene and ... object persistence Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "Lucene and ... object persistence" Watch "Lucene and ... object persistence" New topic
Author

Lucene and ... object persistence

Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
This article seems interesting, opening some kind of a new direction for object persistance.

article

--
./pope


blog - InfoQ.com
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8845

Thanks for the link Ali.


Groovy
Erik Hatcher
Author
Ranch Hand

Joined: Jun 11, 2002
Posts: 111
Originally posted by Ali Pope:
This article seems interesting, opening some kind of a new direction for object persistance.

article

--
./pope


This is certainly a clever way to use Lucene. My main critique of the implementation details is the use of QueryParser for non-human-entered queries. There are many strange things that can occur between parsing and analyzing the query expression that are best avoided by forming queries directly with the API whenever possible - even if that means working with an analyzer directly as QueryParser does under the covers.


Co-author of Lucene in Action
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Erik, as I already stated, I am a very novice to Lucene and so I would very much appreciate if you can detail a little bit your comment.

tia
--
./pope
Erik Hatcher
Author
Ranch Hand

Joined: Jun 11, 2002
Posts: 111
Originally posted by Erik Hatcher:

There are many strange things that can occur between parsing and analyzing the query expression that are best avoided by forming queries directly with the API whenever possible - even if that means working with an analyzer directly as QueryParser does under the covers.


This can be a bit confusing, so bear with me. Lucene includes a parser to parse text expressions like "this AND that" into a query. You can qualify the field to search on using syntax like "field1:value OR field2:value" and so on. The query parser syntax is detailed
here. When the expression is parsed, it also runs the analyzer on each piece of the expression. (we won't go into the analysis details here - its a whole chapters worth!).

A Lucene Query can be constructed through the API, and bypass the parsing/analysis steps.

You can aggregate parsed expressions with API-created queries using BooleanQuery.

How to actually build queries in your system really depends on what you want to do, but I cringe when I see code that string concatenates clauses in expression syntax to be parsed when it could be done more rigorously and less room for error using other techniques.
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Many thanks Erik, now it sounds more clear. I would sau that this is somewhere in the field of string queries vs programatic queries building (f.e. Hibernate simple string queries vs Criteria objects).

--
./pope
 
 
subject: Lucene and ... object persistence
 
Threads others viewed
Response to the Recent Anti-Java Article
Looking up EJB's
Very nice article about Garbage Collection
block with out identifier
lock
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture