Page MenuHomePhabricator

Adapt CirrusSearch semantic search query builder to ask for query highlighting
Open, Needs TriagePublic

Description

CirrusSearch should be adapted to emit a highlight request of type semantic.

Approach could be to re-use the current semantic debug flag to make highlighting opt-in.

Query shape:

{
  "size": 5,
  "_source": [
    "title",
    "page_id"
  ],
  "query": {
    "nested": {
      "path": "passage_chunk_embedding",
      "score_mode": "max",
      "query": {
        "neural": {
          "passage_chunk_embedding.knn": {
            "query_text": "__QUERY__",
            "k": 10
          }
        }
      },
      "inner_hits": {
        "size": 1,
        "_source": {
          "excludes": [
            "passage_chunk_embedding.knn"
          ]
        },
        "highlight": {
          "fields": {
            "passage_chunk_embedding.text": {
              "type": "semantic"
            }
          }
        }
      }
    }
  },
  "ext": {
    "semantic_highlighting_batch": true
  }
}

The semantic highlighter model_id will be set on the search pipeline.

AC:

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Draft: Add stubs for semantic highlighter configrepos/search-platform/cirrus-toolbox!11dcaussesemantic-highlightingmain
Customize query in GitLab

Event Timeline

dcausse renamed this task from Adapt CirrusSearch semantic search query builder to ask for query highlighing to Adapt CirrusSearch semantic search query builder to ask for query highlighting.

Change #1320191 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/CirrusSearch@master] Add support for semantic highlights

https://gerrit.wikimedia.org/r/1320191

Change #1320191 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] Add support for semantic highlights

https://gerrit.wikimedia.org/r/1320191