Hi all, Apologies for the cryptic subject line, but I couldn't think of a more descriptive one-liner to describe my problem/question to you all. Still fairly new to Lucene here, although I'm hoping to have more of a clue once I get a chance to read "Lucene In Action".
I am implementing a search engine using Lucene for a web application. It is not really a free-text search like some other, more standard implementations. The requirement is for the search to be as easy and user-friendly as possible, so instead of specifying the field to search in the query itself - such as ip:192.168.102.230 - and being parsed with QueryParser, the field is being selected via a HTML <select> element, and the search keywords are entered in a text field. As far as I can tell, I basically have two options: (1) Manually prepend the field identifier to the query text, for example: String fullQuery = field + ":" + queryText; then parse this query normally with QueryParser, OR (2) Since I know it is only going to be searching one term, manually create a TermQuery with a Term object representing what the user typed in, for example: Query query = new TermQuery(new Term(field, queryText)); Is there any advantage or disadvantage to any of these, or is one preferable over the other? My gut tells me that directly creating the TermQuery is more efficient since it doesn't have to perform parsing, but I'm not sure. I have other questions, too, but I don't want to get ahead of myself. One at a time... :) Appreciate any help you all might have! -- Joe Attardi