Searchkick boost exact matches
Why not filter catalog_number in where clause:
search(query, fields: ["title^10", "description", "crse_id", "subject" ], facets: [:subject], misspellings: false, where: {catalog_number: 3618}, page: page, per_page: 20 )
In most cases, where clause comes from an IF:
conditions = {}if params[:catalog_number].present? conditions[:catalog_number] = params[:catalog_number].to_iendsearch(query, fields: ["title^10", "description", "crse_id", "subject" ], facets: [:subject], misspellings: false, where: conditions, page: page, per_page: 20 )
You can insert as many as possible filters into where clause, just the same as ActiveRecord.where()