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>