Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple query_by fields to hold same scoring weight, or specify weight per field #42

Closed
stefangomez opened this issue Jun 28, 2018 · 4 comments

Comments

@stefangomez
Copy link

Description

Right now, according to docs:

The order of the fields is important: a record that matches on a field earlier in the list is considered more relevant than a record matched on a field later in the list.

Would be helpful to customize this, even in the simplest manner of multiple fields holding same weight, e.g. 'query_by' => [ [ 'text', 'author' ], 'description' ]
Seems like a pretty common case for a search box not to know what type the user is necessarily searching for.

Steps to reproduce

Expected Behavior

score multiple fields with same weight

Actual Behavior

no way to do this now

Metadata

Typsense Version: 0.9.1

OS: all

btw, typesense is very impressive! Great work! If I can contribute in any way, let me know, and I will try.

@kishorenc
Copy link
Member

@stefangomez Good idea - definitely see this being useful. There are 2 potential ways to achieve this:

  1. Allow the weights to be specified in the query_by parameter in the following format: text:2,author:2,description:1
  2. Have a separate query_by_weights parameter that sets the respective weights for the fields mentioned in the query_by parameter, e.g. query_by=text,author,description&query_by_weights=2,2,1

No. 2 looks cleaner to me.

@kishorenc kishorenc added this to the 0.10.0 milestone Jul 1, 2018
@kishorenc kishorenc removed this from the 0.10.0 milestone Apr 30, 2019
@georgiemathews
Copy link

Is this feature still planned?

@jasonbosco
Copy link
Member

@georgiemathews Yes it is! It's just around the corner - should be out in a couple of weeks.

@jasonbosco
Copy link
Member

Just released v0.18.0 with the ability to specify custom weights for fields, using the new query_by_weights parameter: https://github.com/typesense/typesense/releases/tag/v0.18.0.

For eg: query_by_weights: 1,1,2 with query_by: field_a,field_b,field_c will give equal weightage to field_a and field_b, and will give twice the weightage to field_c comparatively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants