Back

why the index is failing to create in this emergency situation😖

  • 0
  • Databases
  • Web
manazo
23 Mar, 2023, 11:13

i got a deadline in few hours. i'm trying to create an index with DateTime and String attribute, in full-text type. cuz i need to search the string attribute. but it's getting failed every time. is it just a temporary glitch? or we can't have full-text type index with DateTime attributes?

TL;DR
In this support thread, the user is having trouble creating an index with a DateTime and String attribute in full-text type. They are unable to debug the code until the index is created. The user also mentions an issue with the `search` function not working properly. Another user suggests using dummy text or a separate collection instead of an array attribute. It is mentioned that full-text indexes cannot be created with attributes that are not strings. The user continues to struggle with the index creation and asks for help with the specific situation of checking a string array attribute and a DateTime attribute in a range. Another user suggests checking the length of the keyword being passed
Meldiron
23 Mar, 2023, 11:40

Hey 👋 You can check logs of docker compose logs appwrite-worker-databases to see error message

manazo
23 Mar, 2023, 11:49

I got a really big text after running this command. the only red line I can notice there is Index already exists, which isn't true in my case

manazo
23 Mar, 2023, 11:59

I've tried creating my index just with the string type attribute with the index type of fullText, just to check if my logic is correct. tho this time the index creation is successful, but the Query.search() isn't working properly. my queried attribute is a string array type. let's say the attr name is "X". I'm passing an array as the 2nd arg in Query.search. let's name the passed array "Y". this code is expected to return all the docs where "X" contains any value from "Y". But it's returning 0 docs. I've tried this method before, which worked perfectly. but not sure why this ain't working now.

Drake
23 Mar, 2023, 17:59

You can't have full text indexes with attributes that aren't string. See https://github.com/appwrite/appwrite/issues/2995

Drake
23 Mar, 2023, 18:01

It could be the length of the keyword you're passing into the search. For more info on how the search works see https://github.com/appwrite/appwrite/discussions/5005#discussioncomment-4681079

manazo
24 Mar, 2023, 02:42

but my situation kinda requires me to do that. i need to check if a string array type attribute contains some text, also if a DateTime type attribute is in a range. is there any way for me to do that?

manazo
24 Mar, 2023, 02:44

seems search doesn't work with values that are less than 3. my value is a length of 2. now adding dummy text on it is the only way left for me?

Drake
24 Mar, 2023, 03:22

Can you give more concrete examples of the values?

You should be able to use greater than and less than on datetime attributes. Just make sure you send an iso format string in utc

Drake
24 Mar, 2023, 03:23

Yes, dummy text would be the way to go. Either that or don't use an array attribute. But use a separate collection instead

manazo
25 Mar, 2023, 01:12

that's my code. the betDigitArray is a string array type attribute and betDay is DateTime. it's not like I'm not getting the expected data after the request. I can't even create an index with attributes where one is DateTime and the other is String

Drake
25 Mar, 2023, 01:44

What's winnersArray?

You're passing the current datetime (down to the second). Do you have a document in your database with the exact datetime?

manazo
25 Mar, 2023, 01:54

winnersArray is the array that I wanna search in betDigitArray.

yeah, I just noticed I passed the current time, which I don't have in my document (i have but not the exact. only date is same). but as of now, the code isn't the problem ig. we can't even create the index. so until I create it, I can't even start to debug

Drake
25 Mar, 2023, 15:56

True...make sure to 👍🏼 the issue I linked before

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