diff --git a/src/dug/core/async_search.py b/src/dug/core/async_search.py index e0f8f79..df6e0a8 100644 --- a/src/dug/core/async_search.py +++ b/src/dug/core/async_search.py @@ -735,6 +735,42 @@ def get_simple_search_query(self, query): "fields": ["name", "description", "search_terms"], "default_operator": "and", "flags": "OR|AND|NOT|PHRASE|PREFIX" + }, + } + } + simple_query_string_search = { + "query": query, + "default_operator": "and", + "flags": "OR|AND|NOT|PHRASE|PREFIX" + } + search_query = { + "query": { + "function_score": { + "query": { + "bool": { + "should": [ + { + "simple_query_string": { + **simple_query_string_search, + "fields": ["name"] + } + }, + { + "simple_query_string": { + **simple_query_string_search, + "fields": ["description"] + } + }, + { + "simple_query_string": { + **simple_query_string_search, + "fields": ["search_terms"] + } + } + ] + } + }, + "score_mode": "sum" } } } diff --git a/src/dug/server.py b/src/dug/server.py index 5502bcd..e2d7cb5 100644 --- a/src/dug/server.py +++ b/src/dug/server.py @@ -14,7 +14,7 @@ APP = FastAPI( title="Dug Search API", - root_path=os.environ.get("ROOT_PATH", "/"), + root_path=os.environ.get("ROOT_PATH", ""), ) APP.add_middleware(