SearchBlox

SearchBlox Developer Hub

Welcome to the SearchBlox developer hub. Here you will find comprehensive guides and documentation to help you start working with SearchBlox as quickly as possible, as well as support if you get stuck. Let's jump right in!

Guides

Relevancy Tuning & Boosting

Relevancy of search results can be tuned using the url parameters.

Relevancy Tuning in Search

SearchBlox supports relevance tuning of search results through parameters in the search query.

Relevance can be tuned with standard and custom fields boosting.

Standard field Boosting

Standard Fields (title, description, URL, keywords, date recency, URL length and clicklog) can be boosted to tune the relevancy of search results

Parameter
Description
Default value
Range of values
Example

tune

Enables or disables relevance tuning

true

true or false

tune.0

Weight used to increase relevance of document if search query appears in document title

5

1 to 100

tune.1

Weight used to increase relevance of document if search query appears in document description

3

1 to 100

tune.2

Weight used to increase relevance of document if search query appears in keywords meta field

2

1 to 100

tune.3

Weight used to increase relevance of document if search query appears in document url

5

1 to 100

tune.4

Documents within 180 days are ranked higher than older documents. This sets the time period (in days) after which the relevance of documents decreases based on the document last modified date

180

Number of Days
You can give any value between 1 and 1000

tune.5

Shorter urls will be ranked higher than longer urls based on length

10

1 to 100

tune.6

More the number of clicks made to the result, more will be the relevancy

10

1 to 100

It is also possible to boost multiple parameters while boosting as in the examples below:
To boost description and boost documents lesser than 30 days:
http://localhost:8080/searchblox/servlet/SearchServlet?query=time&tune.1=50&tune.4=30
To boost keywords and URL:
http://localhost:8080/searchblox/servlet/SearchServlet?query=time&tune.2=50&tune.3=30
Similarly, different combinations of tuning can be used based on user requirement.
To boost results which have been viewed by the users and boost title
http://localhost:8080/searchblox/servlet/SearchServlet?query=time&tune.6=50&tune.0=30

Custom field Boosting

Custom field boosting can be used by the user to boost fields such as metadata, file properties and other custom fields that are indexed in SearchBlox.

Parameter
Description
Default value
Range of Values
Example

tune.field

Provides the ability to facet on any field

No

Any standard or custom field including term, number or date fields

&tune.field=size&t.size.factor=10&t.size.modifier=square

tune.field.weight

Weight to be used to increase relevance of document if search query appears in document custom field. This is for text field

No

1 to 100

&tune.field=author&t.author.value=john&t.author.weight=100

tune.field.factor

This factor is applicable for numerical field.
Please make sure to add the custom numerical field in your mapping.json.

No

1 to 100

&tune.field=size&t.size.factor=10&t.size.modifier=reciprocal

tune.field.modifier

This factor is applicable for numerical fields and has to be provided with tune.field.factor

No

none - Do not apply any multiplier to the field value
log - Take the logarithm of the field value
log1p Add 1 to the field value and take the logarithm
log2p - Add 2 to the field value and take the logarithm
ln - Take the natural logarithm of the field value
ln1p - Add 1 to the field value and take the natural logarithm
ln2p - Add 2 to the field value and take the natural logarithm
square - Square the field value (multiply it by itself)
sqrt - Take the square root of the field value
reciprocal - Reciprocate the field value, same as 1/x where x is the field’s value
missing - Value used if the document doesn’t have that field. The modifier and factor are still applied to it as though it were read from the document.

To increase relevance larger documents

tune.field=size&t.size.factor=10&t.size.modifier=square

square - If square is provided as modifier greater the field value greater the relevance

To reduce the relevance of larger documents

&tune.field=size&t.size.factor=10&t.size.modifier=reciprocal

reciprocal - If reciprocal is provided as modifier lower the field value greater the relevance

For a numerical field the mapping should be as below in mapping.json or any other relevant file in SearchBlox.
"numfield": {
"type": "double",
"store": true,
"index": false
},

Collection Level Boosting

Boosting can be done at the collection level where results of one collection can be given more relevance or boosting over another. For this, the boost value in the collection settings can be specified within the range 1 - 1000.

Search Level Boosting

Boosting can be done during Search by using ^ operator.

In the below example, software is given boost over test, so results with software will appear on top.
test software^100

In this example, the title field is given more boost over the keywords field, so the results with the title world will appear on top.
e.g, keywords:news title:world^500

Specific content types can be boosted by using the search query with the content type field.

e.g, library AND (contenttype:html OR *)

e.g, (library OR title:library) AND (contenttype:html OR *)

The search boosting query value can be passed through the filter param to avoid the user search term from being changed.

https://localhost:8080/searchblox/servlet/SearchServlet?query=library&filter=library%20AND%20(contenttype:html%20OR%20*)

https://localhost:8080/searchblox/servlet/SearchServlet?query=library&filter=(library%20OR%20title:library)%20AND%20(contenttype:html%20OR%20*)

Changing Relevance internally

Relevance value can be provided internally by editing ../webapps/searchblox/WEB-INF/relevance.yml
The content of yml file will be as follows, the user can provide the weight as per their requirement.

title: 5
description: 3
keywords: 2
url: 100
urllength : 10
lastmodified: 180

After making changes, please restart the build, reindex and then perform the search.

Disabling Relevancy tuning

You can disable relevancy tuning provided based on the above section by providing &tune=false in the search servlet URL
eg: http://localhost:8080/searchblox/servlet/SearchServlet?query=apple&tune=false

Updated 2 days ago

Relevancy Tuning & Boosting


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.