Skip to content

Change "exact match boost" implementation to use a match_phrase query in should #4960

Closed

Description

Problem

We currently use an additional simple query string entry into the boolean filter for search to boost exact phrasal matches on the title of a work:

quotes_stripped = query.replace('"', "")
exact_match_boost = Q(
"simple_query_string",
flags=DEFAULT_SQS_FLAGS,
fields=["title"],
query=f"{quotes_stripped}",
boost=10000,
)

Description

We can bypass simple query string altogether for this, saving some parsing cycles in Elasticsearch, and making our intention much clearer in code (and in the generated query), by using match_phrase directly. This also obviates the need to mock out the simple-query-string syntax for phrasal matches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

  • Status

    ✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions