Re: Number of Boolean Clauses (AND vs OR)
sorry, please ignore this post . it was an old one from nabble.com On Mon, Apr 11, 2011 at 6:13 PM, yangyangyyy tedd...@gmail.com wrote: Thanks Doug: when you say executed in parallel, could you please elaborate more on what execute refers to? I just managed to look through the code. on our Solr setup, by default, a query dog cat (not phrase search) comes to a DisjunctionSumScorer, and if by execute you mean the call to score(), it seems that the DisjunctionSumScorer still evaluates score() serially, just iterating down the multiple subscorers queue scorerDocQueue, as is in DisjunctionSumScorer: protected boolean advanceAfterCurrent() throws IOException { ConjunctionScorer looks similar , just different in the way doNext() iterates through the doc queues. if the above scenario is indeed run in serial, how could we enable parallel evaluation? does that need some special config? (this is lucene 2.9.4 + Solr 1.4.2 ) Thanks a lot Yang ### On 04/11/2011 01:25 PM, entdeveloper wrote: Thanks Otis. And by your answer, does this mean that individual clauses in a boolean query are executed sequentially? not in parallel? Clauses are executed in parallel. The execution of a conjunction is able to efficiently skip occurrences in ranges of documents that do not contain all clauses, while, for a disjunction, every occurrence of every clause must be considered. Doug -- View this message in context: http://lucene.472066.n3.nabble.com/Number-of-Boolean-Clauses-AND-vs-OR-tp2807905p2809558.html Sent from the Lucene - General mailing list archive at Nabble.com.
RE: Number of Boolean Clauses (AND vs OR)
Thanks Doug: when you say executed in parallel, could you please elaborate more on what execute refers to? I just managed to look through the code. on our Solr setup, by default, a query dog cat (not phrase search) comes to a DisjunctionSumScorer, and if by execute you mean the call to score(), it seems that the DisjunctionSumScorer still evaluates score() serially, just iterating down the multiple subscorers queue scorerDocQueue, as is in DisjunctionSumScorer: protected boolean advanceAfterCurrent() throws IOException { ConjunctionScorer looks similar , just different in the way doNext() iterates through the doc queues. if the above scenario is indeed run in serial, how could we enable parallel evaluation? does that need some special config? (this is lucene 2.9.4 + Solr 1.4.2 ) Thanks a lot Yang (this is in response to the thread at http://lucene.472066.n3.nabble.com/Number-of-Boolean-Clauses-AND-vs-OR-tt2807905.html#a2809558 but unfortunately I was not subscribed when the thread started , so posting new now) ### On 04/11/2011 01:25 PM, entdeveloper wrote: Thanks Otis. And by your answer, does this mean that individual clauses in a boolean query are executed sequentially? not in parallel? Clauses are executed in parallel. The execution of a conjunction is able to efficiently skip occurrences in ranges of documents that do not contain all clauses, while, for a disjunction, every occurrence of every clause must be considered. Doug
Re: Number of Boolean Clauses (AND vs OR)
On 04/12/2011 08:53 AM, Yang wrote: when you say executed in parallel, could you please elaborate more on what execute refers to? I mean that all matches for a query clause are not generally enumerated before any results of its containing query are enumerated. There's generally a single thread of execution, so it's not parallel in that sense. Doug
Re: Number of Boolean Clauses (AND vs OR)
Thanks a lot Doug On Tue, Apr 12, 2011 at 10:57 AM, Doug Cutting cutt...@apache.org wrote: On 04/12/2011 08:53 AM, Yang wrote: when you say executed in parallel, could you please elaborate more on what execute refers to? I mean that all matches for a query clause are not generally enumerated before any results of its containing query are enumerated. There's generally a single thread of execution, so it's not parallel in that sense. Doug
Number of Boolean Clauses (AND vs OR)
Does the type of boolean clause matter for a good number of boolean clauses? In other words, if I have a query with 20 boolean clauses, will 20 OR clauses perform any faster or slower than 20 AND clauses? I know these would perform completely different queries, but I am asking on a theoretical level. Obviously the total number matters, hence the limit of 1024 max boolean clauses -- View this message in context: http://lucene.472066.n3.nabble.com/Number-of-Boolean-Clauses-AND-vs-OR-tp2807905p2807905.html Sent from the Lucene - General mailing list archive at Nabble.com.
Re: Number of Boolean Clauses (AND vs OR)
I believe AND will be faster, at least in cases when one of the earlier clauses doesn't actually match any docs, in which case the whole query should terminate early and not evaluate the remaining clauses. Otis Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch Lucene ecosystem search :: http://search-lucene.com/ - Original Message From: entdeveloper cameron.develo...@gmail.com To: general@lucene.apache.org Sent: Mon, April 11, 2011 2:50:28 PM Subject: Number of Boolean Clauses (AND vs OR) Does the type of boolean clause matter for a good number of boolean clauses? In other words, if I have a query with 20 boolean clauses, will 20 OR clauses perform any faster or slower than 20 AND clauses? I know these would perform completely different queries, but I am asking on a theoretical level. Obviously the total number matters, hence the limit of 1024 max boolean clauses -- View this message in context: http://lucene.472066.n3.nabble.com/Number-of-Boolean-Clauses-AND-vs-OR-tp2807905p2807905.html Sent from the Lucene - General mailing list archive at Nabble.com.
Re: Number of Boolean Clauses (AND vs OR)
On 04/11/2011 01:25 PM, entdeveloper wrote: Thanks Otis. And by your answer, does this mean that individual clauses in a boolean query are executed sequentially? not in parallel? Clauses are executed in parallel. The execution of a conjunction is able to efficiently skip occurrences in ranges of documents that do not contain all clauses, while, for a disjunction, every occurrence of every clause must be considered. Doug