mirror of
https://github.com/foomo/typesense.git
synced 2025-10-16 12:45:37 +00:00
Reapply "feat: add queryBy param to SimpleSearch"
This reverts commit cc2074d954.
This commit is contained in:
parent
cc2074d954
commit
dba6561ba1
@ -277,11 +277,9 @@ func (b *BaseAPI[indexDocument, returnType]) SimpleSearch(
|
||||
filterBy map[string][]string,
|
||||
page, perPage int,
|
||||
sortBy string,
|
||||
queryBy string,
|
||||
) ([]returnType, pkgx.Scores, int, error) {
|
||||
// Call buildSearchParams but also set QueryBy explicitly
|
||||
parameters := buildSearchParams(q, filterBy, page, perPage, sortBy)
|
||||
parameters.QueryBy = pointer.String("title")
|
||||
|
||||
parameters := buildSearchParams(q, filterBy, page, perPage, sortBy, queryBy)
|
||||
return b.ExpertSearch(ctx, index, parameters)
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ func buildSearchParams(
|
||||
filterBy map[string][]string,
|
||||
page, perPage int,
|
||||
sortBy string,
|
||||
queryBy string,
|
||||
) *api.SearchCollectionParams {
|
||||
parameters := &api.SearchCollectionParams{}
|
||||
parameters.Q = pointer.String(q)
|
||||
@ -32,6 +33,9 @@ func buildSearchParams(
|
||||
if sortBy != "" {
|
||||
parameters.SortBy = pointer.String(sortBy)
|
||||
}
|
||||
if queryBy != "" {
|
||||
parameters.QueryBy = pointer.String(queryBy)
|
||||
}
|
||||
|
||||
return parameters
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ type API[indexDocument any, returnType any] interface {
|
||||
filterBy map[string][]string,
|
||||
page, perPage int,
|
||||
sortBy string,
|
||||
queryBy string,
|
||||
) ([]returnType, Scores, int, error)
|
||||
ExpertSearch(ctx context.Context, index IndexID, parameters *api.SearchCollectionParams) ([]returnType, Scores, int, error)
|
||||
Healthz(ctx context.Context) error
|
||||
|
||||
Loading…
Reference in New Issue
Block a user