Skip to content

Commit 948977a

Browse files
author
MartinMikita
committed
Changed ranking mode to SPH04 - boosts the matches for exact query. Changed field weights.
1 parent e378a26 commit 948977a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

web/websearch.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ def process_query(index, query, query_filter, start=0, count=0):
7878
cl.SetConnectTimeout(5.0) # float seconds
7979
cl.SetLimits(start, count) #offset, limit, maxmatches=0, cutoff=0
8080
# cl.SetSortMode( SPH_SORT_ATTR_DESC, 'date')
81-
cl.SetMatchMode(SPH_MATCH_EXTENDED2)
81+
# cl.SetMatchMode(SPH_MATCH_EXTENDED2)
82+
cl.SetRankingMode(SPH_RANK_SPH04)
8283
cl.SetFieldWeights({
83-
'title': 30,
84+
'title': 500,
8485
'content': 1,
85-
'tags': 15,
86+
'tags': 20,
8687
})
8788

8889
# Prepare filter for query, except tags

0 commit comments

Comments
 (0)