One of the nice features of SOLR is the ability for doing promoted or recommended searches. With this feature, you can basically use a kind of query (elevation query), that is able to elevate static searches configured by id.
Use case example: Imagine that you have a popular Alfresco blog in your site, and you want that when searching for term "alfresco blog", your first or just a "recommended page" is the solutions page.
In elevate.xml:
<elevate> <query text="alfresco blog"> <doc id="https://www.zylk.net/es/solutions/alfresco" /> </query> </elevate>
In your solrconfig.xml:
<searchComponent name="elevator" class="solr.QueryElevationComponent" > <!-- pick a fieldType to analyze queries --> <str name="queryFieldType">string</str> <str name="config-file">elevate.xml</str> <str name="editorialMarkerFieldName">elevated</str> </searchComponent>
Then in the fl parameter of your query should include the field "[elevated]". Using solr admin with qt=/elevate or the bash script of the other day:
$ ./do-search.sh "alfresco blog" url,score,[elevated] "" elevate zylk
It is clear that if you order by score, you can see something diferent in the resultset.
{ "url": "https://www.zylk.net/es/solutions/alfresco", "score": 0, "[elevated]": true } { "url": "https://www.zylk.net/alfresco-blog", "score": 2.7496874, "[elevated]": false } { "url": "https://www.zylk.net/es/web-2-0/blog/-/categories/36541", "score": 2.3795006, "[elevated]": false }
Links: