@@ -780,8 +780,8 @@ def post(request):
780780
781781class MetadataToConceptsListView (BaseAPIView ): # pragma: no cover
782782 default_limit = 1
783- score_threshold = 5
784- score_threshold_semantic_very_high = 1.64
783+ score_threshold = 0.9
784+ score_threshold_semantic_very_high = 0.9
785785 serializer_class = ConceptListSerializer
786786 permission_classes = (IsAuthenticatedOrReadOnly ,)
787787 es_fields = Concept .es_fields
@@ -845,13 +845,15 @@ def filter_queryset(self, _=None): # pylint:disable=too-many-locals,too-many-st
845845 if limit > 1 :
846846 concept ._match_type = 'low' # pylint:disable=protected-access
847847 score_to_check = normalized_score if normalized_score is not None else score
848- if concept ._highlight .get ('name' , None ) or is_semantic and score_to_check > score_threshold : # pylint:disable=protected-access
848+ if concept ._highlight .get ('name' , None ) or ( is_semantic and score_to_check >= score_threshold ) : # pylint:disable=protected-access
849849 concept ._match_type = 'very_high' # pylint:disable=protected-access
850850 elif concept ._highlight .get ('synonyms' , None ): # pylint:disable=protected-access
851851 concept ._match_type = 'high' # pylint:disable=protected-access
852+ elif concept ._highlight : # pylint:disable=protected-access
853+ concept ._match_type = 'medium' # pylint:disable=protected-access
852854 else :
853855 concept ._match_type = 'very_high' # pylint:disable=protected-access
854- if not best_match or concept ._match_type in ['high' , 'very_high' ]: # pylint:disable=protected-access
856+ if not best_match or concept ._match_type in ['medium' , ' high' , 'very_high' ]: # pylint:disable=protected-access
855857 serializer = ConceptDetailSerializer if self .is_verbose () else ConceptMinimalSerializer
856858 data = serializer (concept , context = {'request' : self .request }).data
857859 data ['search_meta' ]['search_normalized_score' ] = normalized_score * 100
0 commit comments