Skip to content

Commit 4fec2f2

Browse files
committed
OpenConceptLab/ocl_issues#2298 | reranker enabled by default
1 parent 59e30dd commit 4fec2f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/concepts/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
omit_if_exists_in_param, equivalency_map_types_param, search_from_latest_repo_header)
3232
from core.common.tasks import delete_concept, make_hierarchy
3333
from core.common.throttling import ThrottleUtil
34-
from core.common.utils import to_parent_uri_from_kwargs, generate_temp_version, get_truthy_values, to_int, drop_version
34+
from core.common.utils import to_parent_uri_from_kwargs, generate_temp_version, get_truthy_values, to_int, drop_version, \
35+
get_falsy_values
3536
from core.common.views import SourceChildCommonBaseView, SourceChildExtrasView, \
3637
SourceChildExtraRetrieveUpdateDestroyView, BaseAPIView
3738
from core.concepts.constants import PARENT_VERSION_NOT_LATEST_CANNOT_UPDATE_CONCEPT
@@ -829,8 +830,7 @@ def filter_queryset(self, _=None): # pylint: disable=too-many-locals,too-many-s
829830
faceted_criterion = self.get_faceted_criterion(False, filters, minimum_should_match=1) if filters else None
830831
apply_for_name_locale = locale_filter and isinstance(locale_filter, str) and len(locale_filter.split(',')) == 1
831832
encoder_model = self.request.GET.get('encoder_model', None)
832-
reranker = self.request.GET.get('reranker', None) in get_truthy_values() # enables reranker
833-
reranker = reranker and self.request.user.is_mapper_cross_encoder_group
833+
reranker = self.request.GET.get('reranker', True) not in get_falsy_values()
834834
score_to_sort = 'search_rerank_score' if reranker else 'search_normalized_score'
835835
cid = get_cid()
836836
is_bridge = (repo_params.get('owner', None) == 'CIEL' and repo_params.get('source', None) == 'CIEL' and
@@ -850,7 +850,7 @@ def filter_queryset(self, _=None): # pylint: disable=too-many-locals,too-many-s
850850
es_search = CustomESSearch(search[start:end], ConceptDocument)
851851
name = row.get('name') or row.get('Name') if reranker else None
852852
es_search.to_queryset(False, True, False, name, encoder_model)
853-
print(f"[{cid}] ES Search (including reranker) executed in {time.time() - start_time} seconds")
853+
print(f"[{cid}] ES Search (with reranker={bool(reranker)}) executed in {time.time() - start_time} seconds")
854854
start_time = time.time()
855855
result = {'row': row, 'results': [], 'map_config': map_config, 'filter': filters}
856856
for concept in es_search.queryset:

0 commit comments

Comments
 (0)