esselitowE
Convex Community3mo ago
5 replies
esselitow

withSearchIndex multiword not working

I cannot get this to work, I've tried reading the docs, using the AI and also reading up on Tantivy's SimpleTokenizer

If I have a searchIndex on a field that I have specifically created for search, if I use a space I get no results...

So my index:
  orders: defineTable(orderSchema)
    .searchIndex("searchText", {
      searchField: "searchText",
    })


my search example:
.withSearchIndex("searchText", (q) =>
        q.search("searchText", "17992 doe")
      );


one of my orders has a searchText value of:
17992 john doe


Searching for each individually works (17992 or john or doe) and searching in the correct order works, like 17992 john or john doe but not when searching for multiple words that are not in the correct order, but I thought that each space would split and tokenize the words making them searchable as the query in is also tokenized the same so they should match? It makes the search much less useful and very unreliable, so I assume I am doing something wrong

FYI
This happens in Development and Production, on Free and Pro tier
Was this page helpful?