Skip to content

Commit

Permalink
[kbss-cvut/termit-ui#544] Adjust FTS score calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Oct 21, 2024
1 parent 1c3b0a4 commit 8ac703e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions profile/graphdb/query/fulltextsearch.rq
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ SELECT DISTINCT ?entity ?label ?description ?vocabularyUri ?state ?type ?snippet
FILTER (lang(?label) = ?langTag)
BIND(COALESCE(?definition, COALESCE(?scopeNote, ?dcDescription)) AS ?description)
FILTER (!BOUND(?description) || lang(?description) = ?langTag)
BIND(IF(lcase(str(?snippetText)) = lcase(str(?splitExactMatch)), ?initScore * 2, IF(CONTAINS(lcase(str(?snippetText)), ?searchString), IF(?snippetField = "label", ?initScore * 1.5, ?initScore), ?initScore)) as ?exactMatchScore)
BIND(IF(?snippetField = "label", ?exactMatchScore * 2, IF(?snippetField = "definition", ?exactMatchScore * 1.2, ?exactMatchScore)) as ?score)
BIND(IF(lcase(str(?snippetText)) = lcase(str(?splitExactMatch)), ?initScore * 2, IF(CONTAINS(lcase(str(?snippetText)), ?searchString), IF(?snippetField = "prefLabel", ?initScore * 1.5, ?initScore), ?initScore)) as ?exactMatchScore)
BIND(IF(?snippetField = "prefLabel", ?exactMatchScore * 2, IF(?snippetField = "definition", ?exactMatchScore * 1.2, ?exactMatchScore)) as ?score)
}
ORDER BY desc(?score)

0 comments on commit 8ac703e

Please sign in to comment.