Overview
The Rank Fusion feature of Fess integrates multiple search results to provide more accurate search results.
What is Rank Fusion
Rank Fusion is a technique that combines results from multiple search algorithms or scoring methods to generate a single optimized ranking.
Key benefits:
Combines the strengths of different algorithms
Improves search accuracy
Provides diverse search results
Supported Algorithm
Fess supports the RRF (Reciprocal Rank Fusion) algorithm for Rank Fusion.
RRF (Reciprocal Rank Fusion)
RRF calculates a score by summing the reciprocal of each document’s rank in each search result. When a document is retrieved by multiple searchers, its scores are added together.
Formula:
k: Constant parameter that controls the influence of rank (default: 20)rank(d): Rank of document d in each search result (0-based)Σ: Sum over all searchers in which document d appears
Settings
fess_config.properties
Basic configuration:
| Property | Default | Description |
|---|---|---|
rank.fusion.window_size | 200 | Maximum number of results retrieved from each searcher for fusion. Must be >= paging.search.page.max.size × 2 (200 by default); if a smaller value is set, it is automatically raised to this minimum. |
rank.fusion.rank_constant | 20 | The constant k in the RRF formula. A larger value reduces the score difference between higher- and lower-ranked results. |
rank.fusion.threads | -1 | Number of threads used when running multiple searchers in parallel. If 0 or less is specified, availableProcessors × 1.5 + 1 is used automatically. |
rank.fusion.score_field | rf_score | Name of the result-document field used to store the fused score. |
JVM System Properties
The searchers to use are specified as a JVM system property. Add the following to fess.in.sh (or fess.in.bat):
This property behaves as follows:
It is set as a JVM option, not in
fess_config.properties.defaultis the searcher that performs standard keyword search and is always available.semanticis the searcher that performs semantic (vector) search and is available when the Semantic Search plugin (fess-webapp-semantic-search) is installed.If this property is not specified, all registered searchers are used. If none of the specified names match a registered searcher, only the
defaultsearcher is used.Result fusion is performed only when two or more searchers are available. When only one searcher is available, no fusion is performed and normal search results are returned.
Integration with Hybrid Search
Rank Fusion is particularly effective for hybrid search, which combines keyword search and semantic search. To use semantic search, install the Semantic Search plugin (fess-webapp-semantic-search) and add semantic to -Drank.fusion.searchers.
Usage Examples
Basic Hybrid Search
Calculate the BM25 score with keyword search
Calculate vector similarity with semantic search
Fuse both results with RRF
Generate the final ranking
Search Flow:
Performance Considerations
Memory Usage
Memory usage increases because multiple search results are retained.
Use
rank.fusion.window_sizeto limit the maximum number of results to fuse. The main searcher (the leadingdefaultsearcher) retrieves up towindow_sizeresults, while each of the other searchers retrieveswindow_size ÷ number of searchersresults.
Processing Time
Response time increases because multiple searches are executed.
Use
rank.fusion.threadsto set the number of threads for parallel execution.
Troubleshooting
Search Results Differ from Expectations
Symptom: Results after Rank Fusion differ from expectations
Checks:
Verify the results of each search type individually
Adjust the
rank.fusion.rank_constantvalueAdjust the
rank.fusion.window_sizevalueOn deep pages (where
start position × 2is greater than or equal torank.fusion.window_size), fusion is not performed and only the main searcher is used. If you want fused results on more pages, increaserank.fusion.window_size.
Slow Search
Symptom: Search becomes slow when Rank Fusion is enabled
Solutions:
Reduce
rank.fusion.window_size:Adjust
rank.fusion.threads:
Out of Memory
Symptom: OutOfMemoryError occurs
Solutions:
Reduce
rank.fusion.window_sizeIncrease the JVM heap size
Reference
Scripting Overview - Scripting Overview
Search-Related Settings - Advanced Search Settings
LLM Integration Overview - LLM Integration Guide (Semantic Search)