On Jan 19, 2006, at 10:01 AM, [EMAIL PROTECTED] wrote:
I've a question about the lucene search method. What is the different between a search with the class lucene.queryParser.QueryParser and the class lucene.search.Query and their subclasses?

QueryParser is a Query "factory". It takes a String and parses it into a Query, and depending on the expression in that String it could be one of many different types of Query subclasses.

There is no difference in searching at all.... you search with a Query, and how that query got built is immaterial.

For example: With the WildcardQuery I can search for * at the beginning of a term, but not with the method QueryParser.parse(). But I get the same search string with Query.toString(). Why?

QueryParser has its limitations, and one of them is to prevent the possibility of a prefixed wildcard query such as "*foo" which would have to enumerate all terms in the index and quite possibly blow up BooleanQuery as it rewrites the query or perhaps cause performance issues.

QueryParser is a one-size-sorta-fits-all kinda thing. It's a decent general purpose tool to get going, but most of my projects use QueryParser sparingly only within small pieces of the ultimate query.

Some background about my project:
I have to decide if I build a Query with the Query class and their subclasses or if I build it with the static method QueryParser.parse() The sizes of my indexes are pretty different. They might reach a size of 100,000 docs and more. Unfortunately the index changes frequently.
What is the best way to search in such an index, and why?

Pleased for every kind of help!

Neither QueryParser or Query factor into the size of the index or how to manage a frequently changing index, totally unrelated topics.

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to