lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Berryman" <topd...@gmail.com>
Subject Lucene Query Parsing versus Programmatic Query Building with API
Date Thu, 21 Dec 2006 23:30:59 GMT
I've been working for Lucene for a few months now and have implemented a new
search solution for the company that I work for which has turned out very
well.  As such, we are examining its use for other scenarios now.  I'm
trying to do some investigation that centers around the building of the
query used for searching.

Assume that I have an Index with a "Text" Field named "Contents" (to contain
the main text) and another "Keyword" Field named "DocID" (which contains a
text identifier kind of like a SKU which is lower-cased at index time).
When I index the data, I'm doing so using the StandardAnalyzer object.  My
current process builds the query as a string and hands that to the
QueryParser to return the Query.

Example:  Find all documents with the phrase "star wars dvd" in Contents
that have a DocID beginning with "ZXY".

(Contents:"star wars dvd") AND (DocID:ZXY*)

What I'd like to know is how to build this programmatically instead of using
the QueryParser.  I have a general idea, but I'm looking for some help and
validation from the group please.  Can someone out there give me a hand?

Also ... Another question I have is about the Analyzer's involvement here.
When you use the QueryParser object, you pass in the particular Analyzer (in
my case its the StandardAnalyzer) you would like to use when analyzing the
text provided in the parse string.  Why is it that when you are building the
query programmatically, that you dont ever have to specify an Analyzer
object?  I say this because I've been unable to find that
functionality/parameter/property anywhere.  I'm probably missing something
simple here, but it's just not making since to me.

Thanks in advance for the help everyone!
Andy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message