diff --git a/src/morphodict/search/runner.py b/src/morphodict/search/runner.py index c887e5d9b..0e2a1d184 100644 --- a/src/morphodict/search/runner.py +++ b/src/morphodict/search/runner.py @@ -33,6 +33,7 @@ def search( """ search_query = Query(query) + search_results = SearchResults( auto=search_query.auto, verbose=search_query.verbose, @@ -49,7 +50,7 @@ def search( espt_search.convert_search_query_to_espt() if settings.MORPHODICT_ENABLE_CVD: - cvd_search_type = first_non_none_value( + cvd_search_type: CvdSearchType = first_non_none_value( search_query.cvd, default=CvdSearchType.DEFAULT ) diff --git a/src/morphodict/search/util.py b/src/morphodict/search/util.py index 3857bdd91..864ef5262 100644 --- a/src/morphodict/search/util.py +++ b/src/morphodict/search/util.py @@ -5,7 +5,7 @@ T = TypeVar("T") -def first_non_none_value(*l: T, default: Optional[T] = None) -> T: +def first_non_none_value(*l: Optional[T], default: Optional[T] = None) -> T: """ Return the first item in the iterable that is not None. diff --git a/src/morphodict/search_quality/run_sample.py b/src/morphodict/search_quality/run_sample.py index 9b0438554..7d616e33c 100644 --- a/src/morphodict/search_quality/run_sample.py +++ b/src/morphodict/search_quality/run_sample.py @@ -44,10 +44,10 @@ def gen_run_sample( combined_results[query] = { "time_taken_seconds": time_taken, - "results": results, + "results": results.serialized_presentation_results(), } - count = count_results(results) + count = count_results(results.serialized_presentation_results()) yield f"{count:,} results for ‘{query}’ in {time_taken:0.3}s" # "wt" because although gzip is a binary file format, json.dump is going to