Having another problem with Typesense not matching...
# community-help
r
Having another problem with Typesense not matching exact match words. In this case, searching for "OGI indeed" finds no matches and "OGI indee" without the final "d" does find the matches. Here's my query:
Copy code
const searchParameters: SearchParams<TypesenseDocData> = {
    query_by: [
      'title',
      // 5
      'sku',
      'skus',
      'idNumber',
      'rfid',
      'rfids',
      'email',
      'phone',
      // 4
      'name',
      'storageLocation',
      // 3
      'taxId',
      'emails',
      'artistName',
      'companyName',
      'customerName',
      'consignorName',
      'contacts.email',
      'contacts.name',
      'contacts.phone',
    ],
    q: sanitizedInput,
    highlight_start_tag: '<em>',
    highlight_end_tag: '</em>',
    sort_by: '_text_match:desc,createdAt:desc',
    num_typos: '2,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2',
    query_by_weights: '5,5,4,5,4,3,2,2,5,3,2,2,2,2,2,2,1,1,1',
    limit: 50,
    max_candidates: 5000,
    per_page: 50,
    exhaustive_search: true,
  };

  const response = await typesenseClient(searchKey)
    .collections<TypesenseDocData>('global')
    .documents()
    .search(searchParameters);
Previously I had the same problem with searching for "delivery" (no matches) and "deliver" (had the expected matches). I was able to fix that by enabling
exhaustiveSearch: true
and using
query_by_weights
, but this "indeed" issue persists.
j
Hi Richard. There are features like stopwords or stemming that could be causing these issues, for instance here if 'indeed' is a stopword it could be getting stripped from the query. It is difficult to debug without seeing your curl requests (which you have sent), but and also your schema and the results returned. If you are able to recreate the issue locally using this gist we will be able to debug it more effectively.
r
Hi, we're seeing the same behaviour due to
numTypos
. From my checks, it appears to be a regression of issue #815 (typo correction not applied with some combinations of
num_typos
and
query_by_weights
). Typesense version: 30.2, TS Cloud Document:
Copy code
{
  "stock_status": "in-stock",
  "name": "Shimano SM-RT10-S, Center Lock, 160mm"
}
Not found:
Copy code
{
  "q": "SM-RT10-S",
  "query_by": "stock_status,name",
  "query_by_weights": "10,4",
  "num_typos": "0,2"
}
Found (omitting
num_typos
):
Copy code
{
  "q": "SM-RT10-S",
  "query_by": "stock_status,name",
  "query_by_weights": "10,4"
}
Expected: document found via
name
with typo tolerance. Actual: zero results. Removing
num_typos
entirely fixes it. Is this a known regression or is there a workaround? Thanks!
a
Hey Raul, This is likely a well-known non-exhaustive search behavior: Typesense finds a good-enough match for a token in ONE field at zero cost and stops there, so it never tries the typo/prefix variant that would match the field the customer actually cares about. The fix is to add
exhaustive_search=true
(plus,
num_typos=1
and
_text_match:desc
first).