Back

Query.search issue - Parts of the search term are also found

  • 0
  • Databases
  • Web
_alnes_
19 Oct, 2023, 09:03

Hey πŸ™‚

I use this method to create a query array:

TypeScript
      let querys: string[] = [];
      combinations.forEach(combination => {
        querys.push(Query.search('ingredientNames', combination.nameNormalized).toString());
      });

Search word is e.g. bohnen_(weiss) . => "search(ingredientNames, [bohnen_(weiss)])" There is also an underscore between bohnen and (weiss) that cannot be displayed here. But entries with "pfefferkoerner_(weiss)" are also found...

That doesn't make any sense to me. πŸ€”

Any Idea ?

thanks

TL;DR
The user is experiencing an issue with the Query.search method in their code. They are trying to search for a specific term, but parts of the term are also being found, which doesn't make sense to them. They mention that they have stopped using special characters and it worked fine. Another user suggests being creative with indexes for searching. The user provides a code snippet for creating a query array. The specific search term they are using is "bohnen_(weiss)", but entries with "pfefferkoerner_(weiss)" are also being found. The user is unsure why this is happening and asks for any ideas or solutions
_alnes_
19 Oct, 2023, 09:25

Hm, okay. It seems that no special characters or spaces can be used with the ".search" method, otherwise it will separate and search for both?

Tessa
19 Oct, 2023, 17:38

@VincentGe can you take a look at this?

VincentGe
19 Oct, 2023, 17:41

I believe special characters are not searchable in MariaDB fulltext indexes

https://stackoverflow.com/questions/75296013/how-to-search-special-characters-in-fulltext-index-mysql

This might be related

VincentGe
19 Oct, 2023, 17:42

You may have to be creative with your indexes for searching πŸ˜›

_alnes_
19 Oct, 2023, 19:38

thanks πŸ™‚ I dont use special characters anymore and it worked fine.

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