0

I have a fieldType named double_score. The values here are all precomputed and can fit in a double format. I would like to use this score to boost the associated values s.t. solr returns values by this order. Moreover, I'd like to do this from just the schema. This last clause seems to be the one that is tripping up my searching / configuring fu.

Thanks.

EDIT: (dismax)

<requestHandler name="default" class="solr.SearchHandler" default="true">
  <lst name="defaults">
    <str name="defType">dismax</str>    
    <str name="echoParams">explicit</str>
    <int name="rows">10</int>
    <str name="qf">name</str>
    <str name="bq">double_score</str>
    <str name="debug">true</str>
    <str name="q.alt">*:*</str>
  </lst>
</requestHandler>
user592419
  • 5,103
  • 9
  • 42
  • 67

2 Answers2

0

Use sort order if you would like your results to be sorted acording to your double_score field.

You can see here how to use sort after your field: http://wiki.apache.org/solr/CommonQueryParameters#sort

If you want this to be set in your schema you just have to add the sort:double_score as a default parameter for each request:

<requestHandler name="default" class="solr.StandardRequestHandler" default="true">
    <lst name="defaults">
        <str name="sort">double_score</str>                     
    </lst>
</requestHandler>
Dorin
  • 2,482
  • 2
  • 22
  • 38
0

"returns values by this order" if that means a simple sort, go with Dorin's answer.

But to boost results based on fields (you may take several fields into consideration) , see this: http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_make_.22superman.22_in_the_title_field_score_higher_than_in_the_subject_field

Jesvin Jose
  • 22,498
  • 32
  • 109
  • 202
  • I think that this is actually more what I want. I implemented a solution using dismax, but it's not working right. Any insight (code in the edit)? – user592419 Sep 14 '11 at 18:42
  • You need to set qf as double_score. The qf stands for "query field" and they will be the fields that dismax parser will actually consider. You actually set the "boost query", which is not something a newb should jump into :-) Do your homework with the appropriate wiki page http://wiki.apache.org/solr/DisMaxQParserPlugin . – Jesvin Jose Sep 14 '11 at 19:22
  • And do remember that the solrconfig.xml stores default values for parameters and will be overridden at query-time (solr/select?param=overridden_value). Its better to set parameters at query-time: you can tweak parameters easier in a query rather than a config file that will be loaded only once. The defaults are for values to fall back on. – Jesvin Jose Sep 14 '11 at 19:33
  • Hmm. So ideally, I'd return the query by name (e.g. match q=dr to a bunch of doctors) but then reorder those names by double_score, hence boosting the name result. I tried what you said though and put qf as double_score and removed the bq field altogether. I dont get any results now. – user592419 Sep 14 '11 at 19:34
  • That is the scope of a NEW question. I believe I know the answer, but I wont clutter THIS discussion on each new problem you face. Each question should (preferably) cover a well-defined problem statement, with steps: to reproduce what goes wrong/ what you did till now, and the objective you want. Otherwise your question creates less value to the community, hence SO will be less valuable to users. But I will check it out when you inform me the link of your new question. – Jesvin Jose Sep 15 '11 at 05:38
  • I did as you suggested. Here's the new link: http://stackoverflow.com/questions/7432163/dismax-request-handler – user592419 Sep 15 '11 at 14:05