You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sean O'Connor <se...@gmail.com> on 2012/03/22 17:24:12 UTC

Boosting StandardQuery scores with a "subquery"?

Hi all,
     I'm having some trouble wrapping my head around boosting 
StandardQueries. It looks like the function: query(subquery, default) 
<http://wiki.apache.org/solr/FunctionQuery#query> is what I want, but 
the examples seem to focus on just returning a score (e.g. product of 
popularity and the score of the subquery). I assume my difficulty stems 
from the fact that I'd like to retrieve highlighting from one query, but 
impact score and 'relevance' by a different (sub)query.

Example:
q=content:(roi "return on investment" "return investment"~5)
fq=extension:(pdf doc)
boost=keywords:(financial investment profit loss) title:(financial 
investment profit loss) url:(investment investor relations phoenix)

     So what I would like is to highlight the items in the query (e.g. 
'roi' 'return on investment'...) while _not_ highlighting the boosting 
terms (e.g. financial, investment, profit, loss). However, those 
documents with matches for the boost query would be ranked higher than 
those not matching.

     Is there some existing way to do this? I'd like to keep the power 
of the standard queries (i.e. not dismax), and still get results that 
don't match the boost query (i.e. not using a filterquery) while having 
an arbitrary subquery impact the score of the main query while getting 
highlighting for only the main query. Obvious, right? :-) Any thoughts 
or pointers most welcome.
Thanks,

Sean




Re: Boosting StandardQuery scores with a "subquery"?

Posted by Chris Hostetter <ho...@fucit.org>.
:     I'm having some trouble wrapping my head around boosting StandardQueries.
: It looks like the function: query(subquery, default)
: <http://wiki.apache.org/solr/FunctionQuery#query> is what I want, but the
: examples seem to focus on just returning a score (e.g. product of popularity
: and the score of the subquery). I assume my difficulty stems from the fact
: that I'd like to retrieve highlighting from one query, but impact score and
: 'relevance' by a different (sub)query.

if your primary concern is just having highlighting on some words, while 
lots of otherwords contribute to the score, then you should take a look at 
the hl.q param introduced in Solr 3.5...

http://wiki.apache.org/solr/HighlightingParameters#hl.q

That lets you completley seperate the two if you'd like.

you cna even use local param syntax to reduce duplication...

  q={!v=$qq}
  qq=content:(roi "return on investment" "return investment"~5)
  hl.q={!v=$qq}
  fq=extension:(pdf doc)
  boost=keywords:(financial investment profit loss) 
        title:(financial investment profit loss) 
        url:(investment investor relations phoenix)

...should work i think.

-Hoss