Search API
I am using the search API to search images within a subfolder of an instance. Those images have context data given below. I am getting inconsistent results when attempting to do so. I am looking for some guidance for setting up the expression.
Example context data:
[bin] => A2-13-G
[category] => Gift Packaging
[color] => Gray
[filename] => GP13_SPA_10x60x30_1_Gray_A2-13-G
[folder] => photo-accessories/
[photographer] => Elmer Fud
[project] => SPA
[quantity] => 1
[shoot_date] => 2022-01-05
[size] => 10x60x30
[sku] => GP13
If I search using the following I get the expected results.
context:Elmer Fud* AND folder:Chris-api-test/photo-accessories/*
If I search using this I get no result. I would expect this to work. Can you explain why this does not work?
context:Elmer Fu* AND folder:Chris-api-test/photo-accessories/*
Searching for any of the following does not work. Can you explain why this does not work? This seems pretty straight forward. If the previous "Elmer Fud*" example works; why do these not work?
context:SPA* AND folder:Chris-api-test/photo-accessories/*
context:GP13* AND folder:Chris-api-test/photo-accessories/*
context:Gray* AND folder:Chris-api-test/photo-accessories/*
This one works even though there is no context containing "Gift Package*". There is one for "Gift Packaging". Is it doing OR matches on words within my string or something like that?
context:Gift Package* AND folder:Chris-api-test/photo-accessories/*
I don't think it is doing OR matches on each word because if it did then this would work but it does not return any results:
context:Gift* AND folder:Chris-api-test/photo-accessories/*
Any guidance would be much appreciated.
Thanks,
Graham
-
I submitted a Ticket so this is going to be a dupe. Feel free to ignore it.
0 -
Hi Graham,
Just to share the information as provided on the internal ticket, for reference:
1. When doing
context:Elmer Fud*
- it is equivalent to doingcontext:Elmer OR Fud*
where context:Elmer checks the key and Fud* gets tokenized and checked across keys and values
2. Thecontext:Elmer Fu*
will not work because it is translated intocontext:Elmer OR Fu*
where Fu is the prefix, but not a tokenized word
3.context:SPA*
only checks the key
It is recommended to docontext.key:value
.Thanks.
0 -
Ok, that makes sense to me. I looked up the "luncene-like" expression rules and applied them. I assume I should be quoting these to keep them as a single string value with spaces. It seems to work for whole values but when I use a partial; I get inconsistent results. For example; If I search for the following...
context.project:"Gift Pack" OR tags:"Gift Pack" - Results
context.project:"Gift Pac*" OR tags:"Gift Pac*" - Same set of results
context.project:"Gift Pa*" OR tags:"Gift Pa*" - Lesser set of results
Can you explain why I am seeing less results here? I would expect to get the same number of items as the previous 2 searches.
0 -
Hi Graham,
When using partial prefix values (like "Gift P*") it is recommended to use the '=' exact search operator rather than ':'. For example:
context.project="Gift Pa*" OR tags="Gift Pa*"
This should return consistent results. Nevertheless, thank you for reporting this. We will look into the inconsistencies you mentioned above.
0
Post is closed for comments.
Comments
4 comments