Skip to content

Commit

Permalink
Retain search logic fixes that worked (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkis committed Jul 10, 2024
1 parent 0639831 commit 3f61385
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions Tekst-API/tekst/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ async def search_quick(
"audio",
"images",
"externalReferences",
], # constrain target resource types
], # constrain target resource types for quick search
)

# compose a list of target index fields based on the resources to search:
Expand All @@ -366,27 +366,16 @@ async def search_quick(

# compose the query
es_query = {
"bool": {
"must": [
{
"terms": {
"text_id": [str(text_id) for text_id in settings_quick.texts],
}
}
if settings_quick.texts
else None,
{
"simple_query_string": {
"query": query_string or "*", # fall back to '*' if empty
"fields": fields,
"default_operator": settings_quick.default_operator,
"analyze_wildcard": True,
}
},
],
"simple_query_string": {
"query": query_string or "*", # fall back to '*' if empty
"fields": fields,
"default_operator": settings_quick.default_operator,
"analyze_wildcard": True,
}
}

log.debug(f"Running ES query: {es_query}")

# perform the search
return SearchResults.from_es_results(
results=client.search(
Expand Down

0 comments on commit 3f61385

Please sign in to comment.