• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Lucene and ... object persistence

 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article seems interesting, opening some kind of a new direction for object persistance.

article

--
./pope
 
Ranch Hand
Posts: 8934
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link Ali.
 
Author
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
and POOF! You're gone! But look, this tiny ad is still here:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!