Hi there, I am migrating from Algolia to Typesense...
# community-help
g
Hi there, I am migrating from Algolia to Typesense and checking how I best can do an OR in a search. I have a query that says in Algolia. “open_for_others:=true OR companyId:=121” How can I do this in Typesense?
k
Unfortunately we don't have a cross field
OR
support in Typesense yet. Do you mix an OR with ANDs? If not, maybe we can quickly whip up something. The permanent fix will be: https://github.com/typesense/typesense/issues/396
You can do ORs within the same field like this:
age: [10, >20]
(10 OR > 20)
g
We do have a need for AND combined with OR. I now am planning to do a multisearch and distinct at the client. Do you see another possibility?
Copy code
{
  "searches": [
    {
      "collection": "dev_trav",
      "q": "*",
      "filter_by": "location:(47.45,18.97, 50 km) && open_for_others:=true"
    },
    {
      "collection": "dev_trav",
      "q": "608324",
      "query_by": "id",
      "filter_by": "location:(47.45,18.97, 50 km) && companyId:=121"
    }
  ]
}
k
No I don't see another way to do it.
g
Thanks anyhow!
k
👍 This is a high priority item for us, so should be available in the near future.