Boosting using function query...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Boosting using function query...

escher2k
Hi,
  I have three documents in my test data set.
- <doc>
  <str name="id">30</str><str name="name">ABCDE XYZ GHI</str> 
  </doc>
- <doc>
  <str name="id">40</str><str name="name">abcde XYZ GHI</str> 
  </doc>
- <doc>
  <str name="id">50</str><str name="name">abcde XYZ</str> 
  </doc>

I used the standard handler to retrieve the documents where "ghi" or "xyz" are present (http://localhost:8983/solr/select/?q=ghi+xyz&debugQuery=1).
When the results are returned, the document with id = 50 is returned last, since the string "ghi" is not found. I wanted to test if the score can be altered to boost
 the document with id = 50. So, I executed the following dismax query -
http://localhost:8983/solr/select/?qt=dismax&q=ghi+xyz&bf=ord(id)^2.0&debugQuery=1

When I did this, I didn't get any results back. I am not sure if there is anything wrong with my syntax.
The relevant part of the solrconfig.xml file is -
  <requestHandler name="dismax" class="solr.DisMaxRequestHandler">
     <lst name="defaults">
      <str name="echoParams">explicit</str>
    </lst>
  </requestHandler>


I looked at http://www.nabble.com/forum/ViewPost.jtp?post=8002264&framed=y for the
function query discussion.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Boosting using function query...

Chris Hostetter-3

: I used the standard handler to retrieve the documents where "ghi" or "xyz"
: are present (http://localhost:8983/solr/select/?q=ghi+xyz&debugQuery=1).
: When the results are returned, the document with id = 50 is returned last,
: since the string "ghi" is not found. I wanted to test if the score can be
: altered to boost
:  the document with id = 50. So, I executed the following dismax query -
: http://localhost:8983/solr/select/?qt=dismax&q=ghi+xyz&bf=ord(id)^2.0&debugQuery=1
:
: When I did this, I didn't get any results back. I am not sure if there is
: anything wrong with my syntax.

...the dismax request handler builds a DisjunctionMax query out of each of
your search words across each of the "qf" fields -- you have no "qf" param
(and no "qf" in the defaults listed below) so it's not building ny query
for you ... if you look at the debugging info you should see that your
query toString is very very empty except for the boost function.

you cna add a "qf" param if you want, or if you prefer using the standard
request handler syntax, you can still specify a function query as part of
your query using the _val_ syntax hack...

        +(ghi xyz) _val_:ord(id)^2.0

: The relevant part of the solrconfig.xml file is -
:   <requestHandler name="dismax" class="solr.DisMaxRequestHandler">
:      <lst name="defaults">
:       <str name="echoParams">explicit</str>
:     </lst>
:   </requestHandler>



-Hoss