Facet count is wrong when a text query is used
-
HaikoGParticipant3 years, 10 months ago #14765
Hello,
I’ve successfully set up WPSolr with a local Solr engine. Had some problems in the beginning, but was able to solve it with your help two weeks ago.
Now we’re ready for testing and noticed a strange result when search text (?s=gerard&post_type=product)
I get no results, which is expected as there is no product with “Gerard” in the title or description, but I do get a list of facets with counts on them. Clicking a facet, gives me 0 results as well.Replicating the query in the Solr webinterface (fl=*,score&fq=pricelist_ids:”1″&fq=type:(“product”)&q=text:(gerard)&rows=20) also shows no results. So what’s going on that it is showing facets for a query with 0 results?
The counts on the facets are not the total of the facets (for example I get (3) for the color black on the text query, and 3568 black items when not using a text search) so it is filtering on something somehow..
I’ve already tried disabling all custom code running on the website, which did not help.
HaikoGParticipant3 years, 10 months ago #14772Yes, the woocommerce extension is activated.
Is there a way to check the raw results coming from Solr? If I print_r the solr_query from WPSOLR_Events::WPSOLR_ACTION_SOLARIUM_QUERY I do see queryfilters for type:product
- This reply was modified 3 years, 10 months ago by wpsolr. Reason: removed long print_r
HaikoGParticipant3 years, 10 months ago #14776I tried looking in the code, but it is unclear to me how to do that.
When looking at the query though, I do see Query Filters for type:product[filterQueries:protected] => Array
(
[authorized indexed types] => Solarium\QueryType\Select\Query\FilterQuery Object
(
[tags:protected] => Array
(
)[query:protected] => type:(“product”)
[options:protected] => Array
(
[query] => type:(“product”)
[key] => authorized indexed types
))
[bad_statuses] => Solarium\QueryType\Select\Query\FilterQuery Object
(
[tags:protected] => Array
(
)[query:protected] => -post_status_s:(“draft” OR “pending” OR “trash” OR “future” OR “private” OR “auto-draft”)
[options:protected] => Array
(
[key] => bad_statuses
[query] => -post_status_s:(“draft” OR “pending” OR “trash” OR “future” OR “private” OR “auto-draft”)
))
[pricelist_ids:”1″] => Solarium\QueryType\Select\Query\FilterQuery Object
(
[tags:protected] => Array
(
[] => 1
)[query:protected] => pricelist_ids:”1″
[options:protected] => Array
(
[key] => pricelist_ids:”1″
[query] => pricelist_ids:”1″
[tag] =>
))
[type:”product”] => Solarium\QueryType\Select\Query\FilterQuery Object
(
[tags:protected] => Array
(
[] => 1
)[query:protected] => type:”product”
[options:protected] => Array
(
[key] => type:”product”
[query] => type:”product”
[tag] =>
))
[woocommerce type:product] => Solarium\QueryType\Select\Query\FilterQuery Object
(
[tags:protected] => Array
(
[] => 1
)[query:protected] => type:”product”
[options:protected] => Array
(
[key] => woocommerce type:product
[query] => type:”product”
[tag] =>
))
[woocommerce catalog visibility] => Solarium\QueryType\Select\Query\FilterQuery Object
(
[tags:protected] => Array
(
)[query:protected] => ((*:* -product_visibility_str:*) OR -product_visibility_str:(exclude-from-search))
[options:protected] => Array
(
[key] => woocommerce catalog visibility
[query] => ((*:* -product_visibility_str:*) OR -product_visibility_str:(exclude-from-search))
))
HaikoGParticipant3 years, 10 months ago #14777Ok, I found a clue 🙂
I think search suggestions has something to do with this. I found this in the query object
[corrections:protected] => Array
(
[gerard] => gehard
)Gehard is Dutch for hardened which is actually a word that’s used in our descriptions. When searching for ‘Gehard’ I get results and the exact same facets and facet counts. This looks like the facets are using the correction, but the results are not.
What can I do to let the search use the correction as well?
wpsolrKeymaster3 years, 10 months ago #14778Thanks. I could finally reproduce your issue.
Settings:
– “Did you mean activated” in screen 2.1
– “Use my own theme template” in screen 2.1With those settings, one can get facets on mispelled keywords, while the results remain empty.
I’m investigating.
wpsolrKeymaster3 years, 10 months ago #14779It’s a complex problem, and I will no be able to deliver a quick fix.
The fix will be delivered in the next release 21.8. Probably in the next 2 weeks.
You must be logged in to reply to this topic.