Jan,

No, you wouldn't. Let's say that a BooleanQuery with SHOULD clauses is
equal to a DisjunctionMaxQuery with the same clauses up to scores i.e. you
can assert that they returns absolutely same documents, but with the
different scores (max vs sum).

Idea about dropping clauses' weights reminds me CommonTermsQuery i.e.
before the actual search we can check the clause's term frequency and left
only rarest ones because they are supposed to contribute greater score.

The difference between these approaches that DisjunctionMaxQuery also
counts per doc scoring factors like idf and norm, but the second one only
counts docFreq. Which of them you need to care about?


On Tue, Feb 26, 2013 at 3:14 PM, Jan Høydahl <jan....@cominvent.com> wrote:

> Hi,
>
> Thanks, that seems to be the quickest way. But I did not get the part with
> building a DisjunctionMaxQuery from the clauses. I would need to keep it as
> a BooleanQuery, wouldn't I, and compare the weights from each clause and
> nullify all but the max weight clause?
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> Solr Training - www.solrtraining.com
>
> 25. feb. 2013 kl. 21:05 skrev Mikhail Khludnev <mkhlud...@griddynamics.com
> >:
>
> > Jan,
> >
> > I think it's worth to start from extending LuceneQParser. Then after
> > parent's parse() returns a query instance. It can be cast to
> BooleanQuery,
> > after that it's possible to check that all clauses have SHOULD occur, and
> > to create an instance of DisjunctionMaxQuery() from the given clauses.
> > Am I missing something?
> >
> >
> > On Mon, Feb 25, 2013 at 6:32 PM, Jan Høydahl <jan....@cominvent.com>
> wrote:
> >
> >> Hi,
> >>
> >> A customer sends large, deeply nested boolean queries to Solr using the
> >> default (lucene) parser.
> >> The default scoring is summing up all the scores. For parts of this
> query
> >> they would like
> >> to use the Max score instead of the sum, e.g. for q=+A +B +(C D E) we
> want
> >> the max
> >> of C,D,E. I was thinking about writing a MaxScoreQParserPlugin returning
> >> the max of any of its clauses,
> >> so you could express the business requirement as this query: q=+A +B
> >> +_query_:"{!maxscore}C D E",
> >> where C D E could in turn be nested boolean expressions.
> >>
> >> I cannot use DisMax, cause it only returns max across multiple fields,
> not
> >> across multiple clauses.
> >>
> >> Perhaps something like this exists somewhere? If not, any pointers for
> >> where to start, since I'm not
> >> intimately familiar with the Scorer/Weight APIs?
> >>
> >> --
> >> Jan Høydahl, search solution architect
> >> Cominvent AS - www.cominvent.com
> >> Solr Training - www.solrtraining.com
> >>
> >>
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> > Principal Engineer,
> > Grid Dynamics
> >
> > <http://www.griddynamics.com>
> > <mkhlud...@griddynamics.com>
>
>


-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mkhlud...@griddynamics.com>

Reply via email to