See below
Hycel Taylor wrote:
Hi,
I'm new to lucene. I'm unsure as to how to use the QueryParser to
execute a search, retrieved from an end user request.
For example, if an end user enters the query "new your" and selects
"content" from a pull down list, I can easily translate that request
with the QueryParser as the following:
QueryParser query = new QueryParser("new york","content",new
StandardAnalizere());
But, I'm not sure what to do if the end user wants to enter a query
where he/she is search for "new york" from the "content" index and
"weather" from the "description" index. In a case like this, I have
two questions.
1) Is there a specific syntax the user must follow for entering such
search (i.e. new york:content and weather:description)?
See http://lucene.apache.org/java/docs/queryparsersyntax.html for the
Query Parser syntax
2) How can the QueryParser be used if it always needs to know which
index to search from?
(Query Parser doesn't care about the index, but I assume you mean how to
generate queries when you don't know what fields you have available on
each index)
This is generally up to your application to manage. I think most people
end up storing some metadata about each index that contains what fields
are available, etc. Either that or they use conventions to know that
every index has the same fields available. I believe there is also a
method or two on IndexReader that lets you recover what fields are in
the index.
Thanks, in advance, for any help concerning this issue.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Grant Ingersoll
Sr. Software Engineer
Center for Natural Language Processing
Syracuse University
School of Information Studies
335 Hinds Hall
Syracuse, NY 13244
http://www.cnlp.org
Voice: 315-443-5484
Fax: 315-443-6886
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]