Skip to content

Commit 7010ff4

Browse files
committed
and matching in topics
1 parent 4e4b319 commit 7010ff4

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/scholarag/app/routers/retrieval.py

+20-12
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,17 @@ async def article_count(
234234
}
235235
}
236236
if topics:
237-
query["query"]["bool"]["must"].append(
238-
{
239-
"multi_match": {
240-
"query": " ".join(topics),
241-
"fields": ["title", "text"],
237+
query["query"]["bool"]["must"].extend(
238+
[
239+
{
240+
"multi_match": {
241+
"query": wo,
242+
"fields": ["title", "text"],
243+
}
242244
}
243-
}
245+
for word in topics
246+
for wo in word.split(" ")
247+
]
244248
)
245249
if regions:
246250
query["query"]["bool"]["must"].append(
@@ -378,13 +382,17 @@ async def article_listing(
378382
}
379383
}
380384
if topics:
381-
query["query"]["bool"]["must"].append(
382-
{
383-
"multi_match": {
384-
"query": " ".join(topics),
385-
"fields": ["title", "text"],
385+
query["query"]["bool"]["must"].extend(
386+
[
387+
{
388+
"multi_match": {
389+
"query": wo,
390+
"fields": ["title", "text"],
391+
}
386392
}
387-
}
393+
for word in topics
394+
for wo in word.split(" ")
395+
]
388396
)
389397
if regions:
390398
query["query"]["bool"]["must"].append(

0 commit comments

Comments
 (0)