It's quite common to build a Query by API rather than through QueryParser, exactly as you mentioned. Manually run through an Analyzer's output to build whatever type of query clauses desired.

        Erik

On Oct 30, 2009, at 8:55 PM, Ron Grabowski wrote:

Is there a way to avoid using QueryParser altogether? I don't need all the text parsed, I just want to run the name field through an analyzer and use the output of that along with TermQuerys for the zip and city. I'm wanting to do ~2,500 specific searches on an index with between 26m documents. I know ahead of time what most of my fields will be. I thought I could save some time by not having to separate my fields, making a giant string, then having QueryParser split the string back into terms to search.



----- Original Message ----
From: Digy <digyd...@gmail.com>
To: lucene-net-user@incubator.apache.org
Sent: Fri, October 30, 2009 7:45:21 PM
Subject: RE: Is it generally a good idea to avoid using QueryParser if you know how to make the Query yourself?

You can combine queries . (such as your custom "TermQuery" + the result of a
"QueryParser.Parse")

DIGY

-----Original Message-----
From: Ron Grabowski [mailto:rongrabow...@yahoo.com]
Sent: Saturday, October 31, 2009 1:12 AM
To: lucene-net-user@incubator.apache.org
Subject: Is it generally a good idea to avoid using QueryParser if you know
how to make the Query yourself?

I can convert this text into a Query using just TermQuery and BooleanQuery:

name:"ACME Produce" AND city:Anytown AND zip:90210

If I create the Query object on my own will I loose all the benefits from things like StandardAnalyzer? Is there a way I can submit an object graph to QueryParser so I can get the benefits of its analyzer without making it parse the raw string? My input is coming from well defined areas; its not
free form where the user can enter anything they want.

Can I use a StandardAnalyzer myself then take its output and create the
appropriate Query objects then join all of them into a BooleanQuery?

I'm using /tags/Lucene.Net_2_4_0.

Reply via email to