How to use in in hash search

Hello,

This is a bit of a beginner question. I want to be able to implement autocomplete search for certain types in my schema. I saw in the docs I can search by hash, which includes eq and in. My understanding of in is that it will match strings similar to the value provided. However, there are no docs on how in works and there is no in() function in DQL. I guess I could add a regexp directive to the field I want to query on but I don’t know if that’s overkill. Does in work as I think and if it does, how can I use it in a query?

Thanks in advance.

In is used for checking if the value is in a list of values. Suppose the value for the field foo is "bar", then filter: { foo: { in: ["foo", "bar", baz"] } } will match. For autocompletion you’d better use regex indices maybe? (Not an expert)

2 Likes

Thanks! This clears things up regarding in