Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions wikipedia/challenges/common/esql-full-text-functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
"time-period": {{ standalone_search_time_period | default(300) | int }},
"warmup-time-period": {{ standalone_search_warmup_time_period | default(10) | int }}
},
{
"name": "standalone-esql-match-phrase-search",
"operation": "query-esql-match-phrase-search",
"clients": {{ standalone_search_clients | default(20) | int }},
"time-period": {{ standalone_search_time_period | default(300) | int }},
"warmup-time-period": {{ initial_indexing_bulk_warmup_time_period | default(40) | int }}
},
{
"name": "standalone-query-match-phrase-search",
"operation": "query-match-phrase-search",
"clients": {{ standalone_search_clients | default(20) | int }},
"time-period": {{ standalone_search_time_period | default(300) | int }},
"warmup-time-period": {{ standalone_search_warmup_time_period | default(10) | int }}
},
{
"name": "standalone-esql-qstr-search",
"operation": "query-esql-qstr-search",
Expand Down
16 changes: 16 additions & 0 deletions wikipedia/operations/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,22 @@
"size" : {{ query_string_search_page_size | default(20) | int }},
"search-fields" : "{{ query_string_search_fields | default("*") }}"
},
{
"name": "query-match-phrase-search",
"operation-type": "search",
"param-source": "query-search",
"query-type": "match_phrase",
"size" : {{ query_string_search_page_size | default(20) | int }},
"search-fields" : "{{ query_string_search_fields | default("*") }}"
},
{
"name": "query-esql-match-phrase-search",
"operation-type": "esql",
"param-source": "esql-search",
"query-type": "match_phrase",
"size" : {{ query_string_search_page_size | default(20) | int }},
"search-fields" : "{{ query_string_search_fields | default("*") }}"
},
{
"name": "query-kql-search",
"operation-type": "search",
Expand Down
6 changes: 5 additions & 1 deletion wikipedia/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def params(self):
query_body = f'KQL("{ self._search_fields }:{ query }")'
elif self._query_type == "term":
query_body = f'TERM(title, "{ query }") OR TERM(content, "{ query }")'
elif self._query_type == "match_phrase":
query_body = f'MATCH_PHRASE(title, "{ query }") OR MATCH_PHRASE(content, "{ query }")'
else:
raise ValueError("Unknown query type: " + self._query_type)

Expand Down Expand Up @@ -261,11 +263,13 @@ def params(self):
elif self._query_type == "kql":
query_body = {"kql": {"query": f'{ self._params["search-fields"] }:"{ query }"'}}
elif self._query_type == "match":
query_body = {"match": {"content": query}}
query_body = {"bool": {"should": [{"match": {"title": query}}, {"match": {"content": query}}]}}
elif self._query_type == "multi_match":
query_body = {"bool": {"should": [{"match": {"title": query}}, {"match": {"content": query}}]}}
elif self._query_type == "term":
query_body = {"bool": {"should": [{"term": {"title": query}}, {"term": {"content": query}}]}}
elif self._query_type == "match_phrase":
query_body = {"bool": {"should": [{"match_phrase": {"title": query}}, {"match_phrase": {"content": query}}]}}
else:
raise ValueError("Unknown query type: " + self._query_type)

Expand Down
Loading