Back

[SOLVED] AppwriteException: Index not found: created_by,category

  • 0
  • Databases
  • Web
  • Cloud
Susmita
29 May, 2023, 15:41

But how to merge fields into one and then use that inside Query while listing documents?

TL;DR
The user was experiencing an 'AppwriteException: Index not found' error. They were initially using two separate queries for 'created_by' and 'category', but were told that they could combine them into one index with both attributes. It turns out that in version 1.3.4, the requirement for indexes was removed, so they only need a key index with both attributes. The user was also confused about whether to use a fulltext or key index, but it was clarified that they should use a key index since they were doing an AND query. The user also mentioned needing to merge fields into one and use that in the
Bouahaza
29 May, 2023, 15:42

After upload your function to appwrite, you can add events on it (https://appwrite.io/docs/events)

Bouahaza
29 May, 2023, 15:43

So, each time you add/update document on your collection, function will parse fields and concat them to one

Susmita
29 May, 2023, 15:44

But 'created_by' and 'category' are 2 different things represent different values.

Bouahaza
29 May, 2023, 15:45

If you don't want compute search index, you can already search on it

Bouahaza
29 May, 2023, 15:47

Depends of what you want. Title of post means you want to search with on query on created_by and category, no ?

TypeScript
const getIdeas = databases.listDocuments("DATABASE_ID", "COLLECTION_ID",
            [
                Query.equal("created_by", [userId.userId.userId]),
                Query.equal('category', [category])
            ])

Here it's an AND query, wich don't use fulltext index cause it's equal and not search

Bouahaza
29 May, 2023, 15:49

Or am I tired and didn't understand?

Susmita
29 May, 2023, 15:50

Yes, actually it's catergory name

Susmita
29 May, 2023, 15:50

So, do I need to change the fulltext to key?

Susmita
29 May, 2023, 15:59

But that's not working

Bouahaza
29 May, 2023, 16:02

Try to remove createdby and category index, and create one wich include this two attributes ?

Susmita
29 May, 2023, 16:06

One index can't include both of the attributes.

Bouahaza
29 May, 2023, 16:16

Are you on cloud instance ?

Susmita
29 May, 2023, 16:17

Yes

Bouahaza
29 May, 2023, 16:19

For that I thinks. need confirmation from @Steven or others. If I try on 1.3.4, with https:://www.xxx//collections/test/documents?queries[]=equal(created_by, "abc")&queries[]=equal(category, "def") I've result, with or without index

Susmita
29 May, 2023, 16:19

Oh

Drake
29 May, 2023, 16:31

You only need a full text index if you're using the search query. In your case, you should probably be using 1 key index with both attributes

Drake
29 May, 2023, 16:32

In 1.3.4, we removed the requirement to have indexes

D5
29 May, 2023, 17:11

But wasn't that required due to performance concerns?

Drake
29 May, 2023, 17:19

Ya but we decided to take a different approach

Susmita
29 May, 2023, 17:22

1 index key with both attributes? How that's possible?

Drake
29 May, 2023, 18:09

You just add multiple attributes. You can do it in the console

Susmita
30 May, 2023, 01:12

Oh yeah.

Susmita
30 May, 2023, 01:12

Thanks. It's working fine now

Susmita
30 May, 2023, 01:25

[SOLVED] AppwriteException: Index not found: created_by,category

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