I need to search: When I was young, to get that doc
Did your search include the comma? Also, with FTS the matching is done by words and passing in "When I was" matches any document containing any of the words (i.e When
, I
and was
) in the relevant attribute. Partial matches only works if there's only one word in the search term matching any document with any word starting with the query word. E.g.
ID | name
1 | Jane Doe
2 | John Doe
3 | Janet Armstrong
Query.search('name', "Jane")
=> Matches 1,3 (matches both Jane
and Janet
becuase there is a single word in the query thus partial prefix match works)
Query.search('name', "Janet Doe")
=> Matches 1,2,3 (1,2 matched by Doe
and 3 by Janet
)
Query.search('name', "Jane Doe"
=> Matches 1,2 (doesn't match 3 because there are two words in the query and Jane
doesn't match Janet
fully)
Also searching : "When", still not getting that doc, do it yourself sir
No comma included
Same to all these keywords: When - total:0 I - total:0 Was - total:0
But searching: "Young" - total:1, got this doc. Why this happening π
Ok, will test it out
Yes, I can confirm this problem. I'm not sure if some words are sanitised. At first I thought it might have been a length of characters issue but it's not. The issue is also not limited to those words. Hopefully a core member can better explain what's going.
What was the match for "Young"?
Yes, for young I am getting the expected doc, eg. {$id..., text: When I was young I used to think that USB is a country next to USAπ}
When is ignored because it's a stopword I is ignored because it's too short Was is ignored because it's too short
Also not getting result, when I am searching: "When I was"
Then how can i ignore stopwords in appwrite?
I mean how can allow users to also search stopwords combination?
I have an example with 'saw' and that worked so is the length dynamic?
I'm confused because searching for 'a' worked (kind of). Btw I'm using the cli to test.
Actually min length is 3 so that's why saw worked
I and was are ignored because they're stopwords: https://dev.mysql.com/doc/refman/8.0/en/fulltext-stopwords.html#fulltext-stopwords-stopwords-for-innodb-search-indexes
'a' is listed as a stopword but somehow works (again kind of) ...weird
Thanks for the link though
So what gets sent to the DB is a*
so whatever words that start with a will be matched. You won't get a result with only a, though. Or even aw
because aw
is too short
So appwrite follows MySQL rules
Ok, makes sense. I'd have to test it more to understand fully. I was alread aware query*
was being performed but not about the stop words and length
Yes, appwrite uses mariaDB which is basically the same as MySQL (from the little I've read)
I think you would have to find a way to encode the stop words in such a way that you can still perform a search on them
Maybe hashing them in some way
Recommended threads
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...