#community-help

"Query By" Parameters Resulting in Fewer Search Results

TLDR Jon encountered unexpected behavior with "query by" parameters. Upon checking the post request body by Jason, Kishore Nallan noted the issue originates from the typo match with "full stack". Suggested solution was setting split_joins_tokens: always.

Powered by Struct AI

3

Jul 29, 2022 (17 months ago)
Jon
Photo of md5-9d01f9f3c352222b5a7902d087745dc3
Jon
05:45 PM
Hello! I am seeing some strange behavior with Query By parameters. I would expect that adding a new parameter would either not affect search results, or would increase the number of results. But when I add a parameter, I’m actually seeing fewer results. Can you help me understand why?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:49 PM
Hmmm, that sounds like a bug.

Could you open up the browser dev console, then repeat the same search again and then copy as curl the request sent to the .../api/... endpoint, and then paste just the post request body here which has all the search params?
Jon
Photo of md5-9d01f9f3c352222b5a7902d087745dc3
Jon
05:50 PM
sure
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:52 PM
Just needed this:

--data-raw '{"searches":[{"query_by":"title,slug,categories,description,shortDescription","group_by":"","sort_by":"_text_match:desc","highlight_full_fields":"title,slug,categories,description,shortDescription","collection":"catalogContent_20220729T163000","q":"full stack","facet_by":"","page":1,"per_page":5}]}' \
  --compressed

Could you delete the rest of your message, since it contains auth and session information
Jon
Photo of md5-9d01f9f3c352222b5a7902d087745dc3
Jon
05:52 PM
I’ve deleted the message, thanks

1

Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:53 PM
Will take a look and keep you posted later this evening
Jon
Photo of md5-9d01f9f3c352222b5a7902d087745dc3
Jon
05:53 PM
Thanks. Rebecca Doug FYI

2

Jul 30, 2022 (17 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:33 AM
Initially, there's no match for "full stack" query so "treat space as typo" behavior kicks in, and "fullstack" is tried as a fallback which produces results. When the "shortDescription" field is added, the phrase "full stack" itself produces results with typo match with the words "fully" and "stack" in a record so we stop there (1 typo match).

If you set the split_joins_tokens: always then Typesense will always attempt to look for space as typo variations of the query and this will ensure that same set of results are produced with/without the shortDescription field.
Jon
Photo of md5-9d01f9f3c352222b5a7902d087745dc3
Jon
09:19 PM
got it, thanks. I’m sure we would prefer to not treat spaces as a typo, but this is a good fix for now!

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Phrase Search Relevancy and Weights Fix

Jan reported an issue with phrase search relevancy using Typesense Instantsearch Adapter. The problem occurred when searching phrases with double quotes. The team identified the issue to be related to weights and implemented a fix, improving the search results.

6

111
8mo

Issues with Repeated Words and Hyphen Queries in Typesense API

JinW discusses issues with repeated word queries and hyphen-containing queries in Typesense. Kishore Nallan offers possible solutions. During the discussion, Mr seeks advice on `token_separators` and how to send custom headers. Issues remain with repeated word queries.

8

43
25mo

Inconsistent Search Results with Typesense

David reported inconsistencies with infix searching using Typesense, despite no change in configuration. Upon review, Jason could not consistently reproduce the issue and suggested potential fixes including a debug build on the user's cluster. The issue remains unresolved.

6

59
1mo

Resolving Typesense Query Issues

Todd had queries regarding Typesense operation. Jason clarified Typesense's default behavior and provided a recommendation to enhance results ranking based on relevance and recency.

1

11
1mo

Troubleshooting "drop_tokens_threshold" and Typo Tolerance in Typesense

Joe had issues with "drop_tokens_threshold" = 0 and typo tolerance in Typesense, after which Kishore Nallan provided solutions and clarifications on feature functionality. Their issues with the search result limit and tokens were resolved after discussion and testing.

3

29
26mo