Back

[SOLVED] Best way to search multiple indexes?

  • 0
  • Self Hosted
ZachHandley
30 Oct, 2023, 00:40

just curious, is there a better way to search multiple indexes at once rather than doing a listDocuments for each one? Any way to combine search queries to search all full text indices?

TL;DR
Solution: Unfortunately, it is not currently possible to search multiple indexes using the "OR" operation. One workaround is to create a single search attribute that includes all the data you want to search across and then create a full-text index on that attribute. This will allow you to search through multiple attributes at once. Another workaround suggested by a user is to use the "listDocuments" function to search each index separately, but there is no way to combine search queries to search all full-text indices simultaneously.
Drake
30 Oct, 2023, 03:00

Sounds like you want to do an OR?

ZachHandley
30 Oct, 2023, 04:15

Sort of, I was trying to use search over multiple indices

ZachHandley
30 Oct, 2023, 04:15

I have a data table in Vuetify that has a search parameter optionally, and when I search a collection I'd love to be able to search a list of attributes that are fulltext indexed rather than what seems to be like I need to search through each attribute?

Drake
30 Oct, 2023, 04:17

Which is like:

TypeScript
Search(attr1, keyword) OR
Search(attr2, keyword) OR
Search(attr3, keyword)

Since we don't support OR yet, this isn't possible.

One hack with search is you can create 1 search attribute with all the data you want to search across and then create a full text index on that attribute

ZachHandley
30 Oct, 2023, 15:04

Ooooh that’s genius thank you for that ❤️

ZachHandley
30 Oct, 2023, 15:05

I’ll implement that today!!

ZachHandley
30 Oct, 2023, 15:05

[SOLVED] Best way to search multiple indexes?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more