Hello <@U01PL2YSG8L> Is there a way to consider pr...
# community-help
s
Hello @Kishore Nallan Is there a way to consider prefix match for each token separately?
Copy code
eg. rel  fut
searched output: document -> Reliance Future
k
No this is not possible. Primarily because implementing this will be very intensive computationally. Each prefix could produce tens of matching words. For two prefixes if each produces ten words, then total combinations are 10 x 10 = 100
s
Is there any way to solve, in case some one have faced similar issue?
k
Should they always be adjacent words?
Infix search will help but against that's exhaustive so won't support high concurrency.
The only workaround I can think of is storing n grams of the words in an array. So for reliance industries you will store: [r, re, rel, reli, relia, relianc, reliance, i, in, ind, ...]
This way rel ind will produce results fast. This might work for you since you are perhaps indexing stock symbols? There are not many companies so this should not take too much memory.
s
@Kishore Nallan With infix parameter, for
Copy code
eg. query -> rel fut
and: document -> Reliance-Future
will it match both rel & fut in the document?
@Kishore Nallan How many input tokens will be searched in the scenario of INFIX.
Copy code
eg. query -> rel fut
Will both rel & fut be searched in the fields?
k
will it match both rel & fut in the document?
Yes it will.
You can play around with it to get a feel. Some additional details here under the
infix
column here: https://typesense.org/docs/0.24.1/api/search.html#search-parameters
s
To how many tokens INFIX will be applied?
Is it possible to connect over a short huddle?
k
All tokens
s
In our scenario, we are not getting the top matches based upon the both the keywords
Idealy for below example,
Copy code
eg. query -> rel fut
and: document -> Reliance-Future
k
Difficult to say without looking at the overall dataset, your schema and query etc. We do community support in a public slack channel so other users who might be looking for similar information find this conversation helpful. Here's more info if you need private/prioritized support when self-hosting: https://typesense.org/support/
s
Sure Thanks @Kishore Nallan
One last query @Kishore Nallan Is there any feature to apply
prefix
on all the query tokens?
@Kishore Nallan Can you please further guide me on the ngram solution
k
The ngram solution is pretty much what I've described above. You generate ngrams of words in a field and store them as a string array field in Typensese and then search on it.
s
@Kishore Nallan Thanks a lot for suggesting a great solution. Most likely it will solve the problem in our use-case.
👍 1