#community-help

Resolving Typesense Upgrade Issue with Long Slug Field

TLDR After Martin upgraded Typesense (Cloud) to 0.20, searches failing with long slugs. Jason and Kishore Nallan helped resolve it by suggesting to use filter_by for exact matches.

Powered by Struct AI

1

17
31mo
Solved
Join the chat
Jun 16, 2021 (32 months ago)
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
09:24 PM
I have an issue after upgrading Typesense (Cloud) to 0.20. I have a “slug” field in an index for a blog. Looking up a specific post doesn’t work anymore since the upgrade to 0.20, and this relates to the length of the slug (words separated by hyphens). Anything longer than two words makes the query fail. Any query parameter I should add, or changes to the index I can make?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:25 PM
Hi Martin, could you give me an example of a search query (with all the search parameters used) that fails? Also, when you say "fails" does it return a non-200 HTTP error code or does it not return any results?
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
09:31 PM
200 status but zero results.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:31 PM
As a test, could you remove all the hyphens in the search query and try searching as one long word?
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
09:31 PM
When I shorten the query to a partial slug open-access I get three results.
09:33
Martin
09:33 PM
Removing all hyphens fixes it. Even when I keep the first two hyphens.
09:34
Martin
09:34 PM
Thanks a lot Jason I know what to do in my Javascript client. Can you explain what the query parser is doing and how to override it (other than changing the query string)?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:38 PM
So we currently drop all special characters when indexing and when searching. So open-access-may-become-mandatory... will get indexed as openaccessmaybecomemandatory.... Not ideal, but we plan to fix this in an upcoming release, so you can customize how special characters are indexed.
09:39
Jason
09:39 PM
re: solution for the problem at hand - Are you looking to retrieve a single post by its slug?
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
09:40 PM
Yes. And the UI gives me the slug rather than for example the ID (a uuid).
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:41 PM
Could you try setting slug as a faceted field, and then using filter_by: slug:=slug-with-hyphens?
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
09:43 PM
Sure. But need to update schema, so needs a moment. Is filter_by better here than query_by?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:21 PM
Yeah, if you're looking for an exact match and for a single record, filter_by is a better approach
Jun 17, 2021 (31 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:25 AM
I'm able to reproduce this issue. There was indeed a regression on v0.20. The fix is easy enough and I can produce a RC build for you to test locally. If that goes fine, we can upgrade your cluster to the RC version. Does that sound good?
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
04:46 AM
Thanks Kishore Nallan but using filter_by , as suggested by Jason fixes the issue for me.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:47 AM
Ok, sounds good. 👍
Martin
Photo of md5-4c44d17869045701f2ca4035972ad4c5
Martin
04:52 AM
But thanks for looking into this. This might also affect others upgrading to 0.20.

1

Typesense

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

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

Fixing Corrupted Documents and Upgrading Typesense Cloud Version

gab had issues with corrupted documents in Typesense Cloud. Jason suggested upgrading to version 0.24.1.rc, which resolved the issue. They also discussed CORS domain management.

3

30
9mo
Solved

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
Solved

Revisiting Typesense for Efficient DB Indexing and Querying

kopach experienced slow indexing and crashes with Typesense. The community suggested to use batch import and check the server's resources. Improvements were made but additional support was needed for special characters and multi-search queries.

1

46
9mo
Solved

Querying with Typesense-Js and Handling Null Values

michtio was querying using typesense-js and receiving fewer results than expected. Kishore Nallan suggested using different query parameters. Further discussion led to the handling of 'null' values and filtering syntax in the search queries. The thread ended with Jason offering migration support from Algolia to Typesense.

4

39
17mo
Solved

Integrating Semantic Search with Typesense

Krish wants to integrate a semantic search functionality with typesense but struggles with the limitations. Kishore Nallan provides resources, clarifications and workarounds to the raised issues.

6

75
11mo
Solved