Is it possible to put boosted fields in front of other if its already sorted?
I have products that are sorted by popular ASC (its integer), but there are some specific products that I want to boost in front of other products, no matter what value is popular.
I am new with Solr, and I have got so far that I need to use edismax, right? But I dont exactly understand how it works, I always get popular products sorted first.
I have following query params:
"sort": "popular ASC",
"bq": "(product_id: 123)^100",
This is called elevation in search.
In solr, QueryElevationComponent might be what you need,
Brief usage step:
solrconfig.xml.elevate.xml, and define the top rows, usually by specify the doc ids.enableElevation / forceElevation / .. to specify whether enable elevation. And yes, it works well with parser DisMax or eDisMax.Refer:
https://cwiki.apache.org/confluence/display/solr/The+Query+Elevation+Component
http://wiki.apache.org/solr/QueryElevationComponent
I updated the above refer link with a better one, check that.
The doc id is the id field of the doc.
What's more important are:
queryFieldType attribute of <searchComponent>, it specify the field type, thus decide the analyzer used, for English text, you might need text_en, don't use the default string, which won't analyze the query input./elevate instead of /select, when query.enableElevation=true&forceElevation=true, so that to enable elevate sorts.fl=*,[elevated]About params:
enableElevation, whether enable elevation, it don't override sort, means when sort param is specified, whether elevated docs are still on top depends on forceElevation param.forceElevation, whether force elevation, it will override sort, means when sort param is specified, will still put elevated docs at top, then sort other docs.solrconfig.xml: (add before </config>)
<!-- elevation -->
<searchComponent name="elevator" class="org.apache.solr.handler.component.QueryElevationComponent" >
<str name="queryFieldType">text_en</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
<requestHandler name="/elevate" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
elevate.xml: (e.g put it in solr-5.4.1/server/solr/dummy/conf/)
<?xml version="1.0" encoding="UTF-8" ?>
<elevate>
<query text="Eric">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>
</elevate>
This file is load once on startup, after change, need reload the core, e.g via solr admin.
query example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With