Back

Queries search response 500

  • 0
  • Flutter
rodoadri
27 Mar, 2023, 01:56

I am sending search queries and I am getting a 500 error [search("restaurantId", ["641e429c2e05e757c5d1"]), search("menu", ["test menu 1"]), limit(20)] ErrorHandler.handle {message: Server Error, code: 500, type: general_unknown, version: 1.2.1}

TL;DR
The user is experiencing a 500 error when sending search queries. They are trying to wrap their search term in double quotes but are unsure how to do so. They are also questioning if their assumptions about the search results are correct. The solution suggested is to create a full text index on only the 'menu' field. The user confirms that they have injected the necessary dependencies and are running the query on the correct database and collection. However, they still receive a 500 error with the given search queries. No solution for the 500 error is provided in the thread.
safwan
27 Mar, 2023, 02:00

Just to be sure, are you running the query on the correct database and collection?

rodoadri
27 Mar, 2023, 02:18

yes. inject dependencies in init projec.

Drake
27 Mar, 2023, 02:22

Would you please try creating a full text index on only menu?

rodoadri
27 Mar, 2023, 02:30

yes, but this is not working as it should.

i add images response-query-data

  1. in response have menu value is test
  2. in query menu value is test menu 2
  3. in data menu is test

I think the answer is wrong, because test menu 2 has no similarity with test,

If it were the other way around, perhaps we could say that menu test menu 2 contains test and that is why it is displayed.

are my assumptions correct? either ?

Drake
27 Mar, 2023, 04:04

That is how search works. It kind of does an OR for each word you pass. You can try to wrap your search term in double quotes to see how it does

rodoadri
27 Mar, 2023, 04:08

i use _genericSearch.field != null ? queries.add(Query.search('menu', _genericSearch.field!)) : null; I don't know how to wrap in double quotes 😦

Drake
27 Mar, 2023, 04:09

'"' + _genericSearch.field! + '"'

rodoadri
27 Mar, 2023, 04:11

working.........

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