Disabling the reranker in Cortex Search queries

Cortex Search includes a reranker that aims to elevate results with higher relevance to the query. However, the reranking step can noticeably increase query latency. Therefore, you can disable reranking in any Cortex Search query, reducing latency at the potential expense of search quality, If you’ve found that reranking does not improve search quality for your use case, disabling it can improve search performance without penalty.

Usage

Querying a Cortex Search Service without the reranker

You can disable the reranker for an individual query at query time in the scoring_config.reranker field in the following format:

{
  "reranker": "none"
}
Copy

Properties:

  • reranker (string, optional): Parameter that can be set to “none” if the reranker should be turned off. If excluded or null, the default reranker is used.

Example

Querying a Search Service without the reranker (Python)

The following code queries the service without the reranking step using the Python API:

resp = business_documents_css.search(
  query="technology",
  columns=["DOCUMENT_CONTENTS", "LAST_MODIFIED_TIMESTAMP"],
  limit=5,
  scoring_config={
    "reranker": "none"
  }
)
Copy

Tip

To query a service with the reranker, omit the "reranker": "none" parameter from the scoring_config object, as reranking is the default behavior.

Querying a Service without the reranker (SQL)

The following SQL statement queries the service without the reranking step using the SEARCH_PREVIEW function.

SELECT
    value['DOCUMENT_CONTENTS'], value['LAST_MODIFIED_TIMESTAMP']
FROM TABLE(FLATTEN(PARSE_JSON(SNOWFLAKE.CORTEX.SEARCH_PREVIEW(
    'business_documents_css',
    '{
      "query": "technology",
      "columns": ["DOCUMENT_CONTENTS", "LAST_MODIFIED_TIMESTAMP"],
      "scoring_config": {
        "reranker": "none"
      }
    }'
))['results'] ));
Copy

Usage notes

Disabling reranking reduces query latency by 100-200ms on average, but it is likely to degrade search quality. The magnitude of the quality degradation depends on the dataset. Evaluate side-by-side results with and without reranking before deciding to disable it in queries.