Relevance Tuning
Control which results appear first in search — without writing complex code.
Relevancy Tuning in Search
Relevancy Tuning lets you decide how search results are ranked — so the most useful content always appears at the top. By default, SearchBlox ranks results based on how closely a document matches the search query. With Relevancy Tuning, you can go further: give extra weight to the title, boost recently updated documents, prioritise frequently clicked results, or promote specific content types — all from the Admin Console or via URL parameters.
Key Features
- Pre-Made Templates:
Use built-in tuning templates to quickly adjust relevance for common content types. - Custom Templates:
Create and save your own relevance settings as templates based on your organization’s specific content needs. - Preview Tuned Results:
Preview search results after applying tuning to ensure the changes work as expected. - Field Boosting:
Improve ranking by boosting important fields such as title, metadata, or custom fields. - URL Parameters:
Apply relevancy tuning dynamically by using URL parameters in the search query.
How to Use Relevancy Tuning:
- Access Relevancy Tuning Settings:
Go to the Relevancy Tuning section in the SearchBlox Dashboard. - Choose a Template:
Select a pre-made template or create a custom template based on your needs. - Adjust Field Boosting:
Set boost values for fields such as title, description, or metadata to control their impact on search ranking. - Preview Results:
Use the preview option to check how the tuned search results will appear. - Save and Apply:
Save the settings and apply the tuning to your search interface.
Standard Field Boosting
Standard fields are the built-in fields SearchBlox indexes for every document — such as the title, description, URL, and keywords. You can increase the weight of any of these fields so that documents matching your search term in that field rank higher.
For example, if a user searches for "annual report" and you want documents where the title contains those words to rank above documents where they only appear in the body text, you would boost the Title field.
The table below lists each tunable field, what it does, and an example URL showing how to apply it.
| Parameter | Description | Default value | Range of values | Example |
|---|---|---|---|---|
| tune | Enables or disables relevance tuning | true | true or false | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune=false |
| Title(tune.0) | Increases the relevance of a document when the search term appears in the title | 25 | 1 to 100 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.0=50 |
| Description(tune.1) | Weight used to increase relevance of document if search query appears in document description | 15 | 1 to 100 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.1=50 |
| Keywords(tune.2) | Weight used to increase relevance of document if search query appears in keywords meta field | 25 | 1 to 100 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.2=50 |
| Keywords in URL(tune.3) | Weight used to increase relevance of document if search query appears in document url | 10 | 1 to 100 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.3=50 |
| Last modified date(tune.4) | Documents within 180 days are ranked higher than older documents. Gives preference to documents modified within a recent number of days. The relevance decreases for older documents.last modified date | 1 | Number of Days You can give any value between 1 and 1000 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.4=30 Number of days = 30 |
| URL length(tune.5) | Shorter URLs will be ranked higher than longer URLs based on length | 1 | 1 to 100 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.5=50 |
| Click weight(tune.6) | More the number of clicks made to the result, more will be the relevancy | 5 | 1 to 100 | https://localhost:8443/rest/v2/api/search?public=true&query=time&tune.6=50 |
SearchBlox allows you to apply multiple boosts together using URL parameters, giving you more control over how search results are ranked. This flexibility helps you fine-tune results based on specific requirements.
- Boosting Description and Recent Documents:
You can boost the description field and prioritize documents that were updated within the last 30 days using a single search URL. Use the following URL:
https\://localhost:8443/rest/v2/api/search?public=true&query=time&tune.1=50&tune.4=30
tune.1=50: Boosts the description field by a factor of 50.
tune.4=30: Boosts documents that are less than 30 days old.
- Boosting Keywords and URL:
To increase the importance of the keywords field and the URL field in search results, you can use this URL:
https\://localhost:8443/rest/v2/api/search?public=true&query=time&tune.2=50&tune.3=30
tune.2=50: Boosts the keywords field by a factor of 50.
tune.3=30: Boosts the URL field by a factor of 30.
- Boosting Viewed Results and Title:
If you want documents that users click on often to appear higher, and also want the title field to be stronger, use this URL:
https\://localhost:8443/rest/v2/api/search?public=true&query=time&tune.6=50&tune.0=30
tune.6=50: Boosts results that have been viewed by users.
tune.0=30: Boosts the title field by a factor of 30.
tune.0 Boosts the title field.
tune.1 Boosts the description field.
tune.2 Boosts the keywords field.
tune.3 Boosts the URL field.
tune.4 Boosts documents based on recency (e.g., less than 30 days old).
tune.6 Boosts results based on user views (popularity).
Custom Field Boosting
Custom Field Boosting lets you adjust the ranking of documents based on your own custom fields. These fields can include metadata, file properties, or any additional fields added to 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 shown in mapping.json or any other relevant file in SearchBlox.
"numfield": {
"type": "double",
"store": true,
"index": false
},
Manual Rank (or mRank)
Manual Rank (mRank) lets you pin a specific document to the top of search results for any query — overriding all other relevance settings. This is useful when you always want a particular page (like a product homepage or a policy document) to appear first, regardless of what the user searches for.
Note: To use mRank correctly, you must also adjust the sorting settings in the Relevancy Tuning preview window. The rank will not take effect without the corresponding sort configuration.
Search Level Boosting
Search Level Boosting lets you prioritise certain words or fields directly in a search query using the ^ operator. This is useful when you want a specific term or field to carry more weight for a particular search without changing your global relevance settings.
Boost a word: Add ^ followed by a number after any word. The higher the number, the more that word influences ranking.
Specific content types can be boosted by using the search query with the content type field.
example, library AND (contenttype:html OR *)
example, (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:8443/rest/v2/api/search?query=library&filter=libraryAND(contenttype:htmlOR*)
https://localhost:8443/rest/v2/api/search?query=library&filter=(libraryORtitle:library)AND(contenttype:htmlOR*)
After making changes, please restart the build, reindex and then perform the search.
Disabling Relevancy tuning
Relevancy tuning can disabled provided based on the preceding section by providing &tune=false in the search servlet URL
Example:
https://localhost:8443/rest/v2/api/search?public=true&query=apple&tune=false
Updated about 7 hours ago
