Search on shopifyProduct is broken
This screenshot tells me the search index was never generated on this new merchant who just installed our app.
Verified the product with title contains "OCEAN" is in our database
Verified Gadget's search index is broken
How can I debug the search index's status for the shopifyProduct table?

17 Replies
Pretty certain the following won't work, you're trying to do related filtering and search at the same time and this isn't supported. You should just filter directly on shopId which you should have on the shopifyProduct model.
So somethign like this?
Instead of:
filter: { shop: { equals: 74920165620 } },
Have:
filter: { shopId: 74920165620 },
AND
filter: { shopId: { equals: 74920165620 } },
Both give me an error .
Perhaps I got your recommendation wrong @ljspoor94 ?
What error?
First one gve me CombinedError:"[GraphQL] Variable "$filter" got invalid value 74920165620 at "filter.shopId"; Expected type "IDFilter" to be an object
Second one didnt give an error but returned empty. So still not doing what I want.
Thats expected for the first one, you have to pass an object against the field
For the second one, I passed the shopId instead of Shop as you recommended, but search still not working.
Please note that searching is done on a completely separate database than what filter is run on (ElasticSearch). For that reason you can't search and filter at the same time. I would recommend that you add some functionality to search with a startsWith filter. I typically recommend that you have a lowercase version of the searched on field so that your users don't need to have an exactly match
is there a "contains" ? startsWith wont work for our use case as merchants often ONLY know keywords in the product and are often not sure of the first few letters.
No, there isn't a contains, yet
😦
for my own future reference - is there a doc on gadget I can read that lists all teh filter options?
Anotine, I want to implement a simple product search box.
To reiterate what you said, the CANONICAL way of searching for products in Gadget is to:
1. Lowercase the product title and store it in a separate field on shopifyProduct
2. In the product UI jsx make a call like this:
Did I get that correct Antoine?
Ideally if we can do something like then it'd be awesome.
Here I'm assuming that the api object has inbuilt mechanisms to filter based on the shop from the session. But not sure if the latter is possible.
Are you doing this on the front-end or back?
Because if its the front-end, you don't need to filter by shopId as tenancy will handle that for you, and you can just use
search
then.Yes doing it on front end @ljspoor94 This solves my problem. Thanks!
Antoine, is it ever possible that the database used for searching is behind / not in sync with the regular database?
I ask because I’d like to know the most reliable method for the merchant to search their products immediately after app installation. Do you see a risk to use search in this case? For eg if there is index generation work that typically takes a while then we should not use the search feature.
In that case we should use the startswith that you recommended.
Do you seem to have a model thats behind? The database should typically be pretty in sync
This happened yesterday. See screenshot above. It seems to have caught up. Did you folks have a backlog yesterday?
Anyhow, if this doesn’t typically happen then I will feel much relieved to use the search database.
I would be surprised that the database was out of date yesterday as people aren't typically working over the weekend so no database or infra errors should have popped up
Ok. I hope there is some sort of a log that shows the sync delays?
There shouldn't be any sync delays. If you see anything weird, please let us know