#community-help

Query_by and Query_by_weights Parameters in Typesense

TLDR Kevin didn't understand the result when using query_by + query_by_weights. Jason asked for a sample to assist but Kevin figured it out, asking for more details about weights assignment.

Powered by Struct AI
5
2mo
Solved
Join the chat
Jul 17, 2023 (2 months ago)
Kevin
Photo of md5-9ed470b5b3554b483d2ea5fd760cb7d5
Kevin
06:41 PM
i am trying to figure out how to use the query_by + query_by_weights and receiving a strange result. when i do not use query_by_weights, i get the correct result as the top result. however when i use query_by_weights even if i sent every single weight to the same value (50), i receive a different result. in fact, the top result i was looking for is not even included in the top 100.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
07:42 PM
Could you give me an example of what you mean? A few sample documents, search query (with all search params) would be helpful to figure out what’s going on
Kevin
Photo of md5-9ed470b5b3554b483d2ea5fd760cb7d5
Kevin
08:17 PM
could i dm this to you?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
08:26 PM
I’d prefer to respond publicly in #community for the benefit of future users who might be looking for info around this in the future.

It doesn’t have to be your actual dataset. Just an example to reproduce the issue you’re talking about would be helpful: https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b
Kevin
Photo of md5-9ed470b5b3554b483d2ea5fd760cb7d5
Kevin
10:32 PM
i think i figured it out actually- in your docs you mention that the fields listed earlier in the query_by parameter are weighted higher. i assume when i supply the query_by_weights parameter, it overrides this higher weighting provided to the fields listed earlier in query_by.

is there a place where i can learn more about how typesense assigns these higher weights to the terms that come earlier in query_by? would love to know what the actual weights are so i can tweak them when i supply my query_by_weights param