Blogs

Using the editorial marker field in SOLR elevation component

Recommended search in SOLR

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:

More Blog Entries

Playing with SOLR Cloud and REST API

Last days I've been involved in an enterprise search project based on Apache Nutch and Apache...

SOLR client APIs

In SOLR, you may find different client APIs for your favourite programming language such as...

0 Comments