fix: search fix for magazines and other docs
This commit is contained in:
@@ -181,6 +181,8 @@ func (h *SearchHandler) multiSearch(ctx context.Context, collections []string, q
|
||||
}
|
||||
|
||||
exhaustive := true
|
||||
prioritizeExact := true
|
||||
prioritizeTokenPos := true
|
||||
searches := make([]api.MultiSearchCollectionParameters, 0, len(collections))
|
||||
for _, col := range collections {
|
||||
queryBy := collectionQueryByFields[col]
|
||||
@@ -196,6 +198,10 @@ func (h *SearchHandler) multiSearch(ctx context.Context, collections []string, q
|
||||
Prefix: stringPtr("true"),
|
||||
NumTypos: stringPtr("2"),
|
||||
ExhaustiveSearch: &exhaustive,
|
||||
// Boost docs whose tokens are exact matches and appear early in the field
|
||||
// so "karma" outranks "karmic" and frequent matches outrank single ones.
|
||||
PrioritizeExactMatch: &prioritizeExact,
|
||||
PrioritizeTokenPosition: &prioritizeTokenPos,
|
||||
}
|
||||
if weights != "" {
|
||||
params.QueryByWeights = stringPtr(weights)
|
||||
@@ -254,6 +260,8 @@ func (h *SearchHandler) singleSearch(ctx context.Context, collection, query stri
|
||||
}
|
||||
|
||||
exhaustive := true
|
||||
prioritizeExact := true
|
||||
prioritizeTokenPos := true
|
||||
params := &api.SearchCollectionParams{
|
||||
Q: stringPtr(query),
|
||||
QueryBy: stringPtr(queryBy),
|
||||
@@ -262,6 +270,10 @@ func (h *SearchHandler) singleSearch(ctx context.Context, collection, query stri
|
||||
Prefix: stringPtr("true"),
|
||||
NumTypos: stringPtr("2"),
|
||||
ExhaustiveSearch: &exhaustive,
|
||||
// Boost docs whose tokens are exact matches and appear early in the field
|
||||
// so "karma" outranks "karmic" and frequent matches outrank single ones.
|
||||
PrioritizeExactMatch: &prioritizeExact,
|
||||
PrioritizeTokenPosition: &prioritizeTokenPos,
|
||||
}
|
||||
if weights := collectionQueryByWeights[collection]; weights != "" {
|
||||
params.QueryByWeights = stringPtr(weights)
|
||||
|
||||
Reference in New Issue
Block a user