The motivation for the constant-score rewrite is simply performance. As per
the Javadoc:

"*This method is faster than the BooleanQuery rewrite methods when the
number of matched terms or matched documents is non-trivial. Also, it will
never hit an errant BooleanQuery.TooManyClauses exception.*"

So that's a second reason - to avoid the max clause count limitation of
Boolean Query.

See:
https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/search/MultiTermQuery.html#CONSTANT_SCORE_REWRITE
https://lucene.apache.org/core/5_4_0/core/org/apache/lucene/search/WildcardQuery.html


-- Jack Krupansky

On Wed, Jan 6, 2016 at 6:07 AM, Modassar Ather <modather1...@gmail.com>
wrote:

> Please help me understand why queries like wildcard, prefix and few others
> are re-written into constant score query?
> Why the scoring factors are not taken into consideration in such queries?
>
> Please correct me if I am wrong that this behavior is per the query type
> irrespective of the parser used.
>
> Thanks,
> Modassar
>
> On Wed, Jan 6, 2016 at 12:56 PM, Modassar Ather <modather1...@gmail.com>
> wrote:
>
> > Thanks for your response Ahmet.
> >
> > Best,
> > Modassar
> >
> > On Mon, Jan 4, 2016 at 5:07 PM, Ahmet Arslan <iori...@yahoo.com.invalid>
> > wrote:
> >
> >> Hi,
> >>
> >> I think wildcard queries fl:networ* are re-written into Constant Score
> >> Query.
> >> fl=*,score should returns same score for all documents that are
> retrieved.
> >>
> >> Ahmet
> >>
> >>
> >>
> >> On Monday, January 4, 2016 12:22 PM, Modassar Ather <
> >> modather1...@gmail.com> wrote:
> >> Hi,
> >>
> >> Kindly help me understand how will relevance ranking differ int
> following
> >> searches.
> >>
> >> query : fl:network
> >> query : fl:networ*
> >>
> >> What I am observing that the results returned are different in both of
> >> them
> >> in a way that the top documents returned for q=fl:network is not present
> >> in
> >> the top results of q=fl:networ*.
> >> For example for q=fl:network I am getting top documents having around 20
> >> occurrence of network whereas the top result of q=fl:networ* has only
> >> couple of occurrence of network.
> >> I am aware of the underlying normalization process participation in
> >> relevance ranking of documents but not able to understand such a
> >> difference
> >> in the ranking of result for the queries.
> >>
> >> Thanks,
> >> Modassar
> >>
> >
> >
>

Reply via email to