Skip to content

Commit a4c3640

Browse files
authored
Skip /query endpoint for rephrased query if not needed (#3645)
1 parent af8bde9 commit a4c3640

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • nucliadb/src/nucliadb/search/search/query_parser/parsers

nucliadb/src/nucliadb/search/search/query_parser/parsers/common.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ async def parse_keyword_query(
9696
) -> KeywordQuery:
9797
query = item.query
9898

99-
# If there was a rephrase with image, we should use the rephrased query for keyword search
100-
rephrased_query = await fetcher.get_rephrased_query()
101-
if item.query_image is not None and rephrased_query is not None:
102-
query = rephrased_query
99+
# only when a query image is used, we use the rephrased query for keyword
100+
# search
101+
if item.query_image is not None:
102+
rephrased_query = await fetcher.get_rephrased_query()
103+
if rephrased_query is not None:
104+
query = rephrased_query
103105

104106
is_synonyms_query = False
105-
106107
if item.with_synonyms:
107108
synonyms_query = await query_with_synonyms(query, fetcher=fetcher)
108109
if synonyms_query is not None:

0 commit comments

Comments
 (0)