> I have a situation where there are users that create n keywords. I'm storing > them as individual DB fields for aggregating scores and then building the > query from the fields. Is it faster for Lucene to parse a query of terms > that are OR'd together or to build it up as a loop of BooleanQuery marked as > SHOULD.
Are you asking if it will be quicker for the lucene query parser to convert a long query string into a Query object or for you to do it yourself? I'd guess the latter might be marginally faster but that you'd be hard pressed to tell the difference. Try it and see. > To complicate things, (like my previous post on explain), some keywords are > phrases. Parsing does conveniently convert multi-word keywords to phrases, > which I assume I'd have to do if I'm building up a BooleanQuery list. Presumably. Doesn't sound hard. All queries produced by the parser can also be produced in code. There are no fixed rules on which is best. You can also mix and match, by creating a BooleanQuery and adding whatever you want to it. BooleanQuery bq = new BooleanQuery(); bq.add(some PhraseQuery, ...); bq.add(parser.parse("some random text"), ...); etc. -- Ian. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org