pantheon-systems / solr-power

A WordPress plugin to connect to Pantheon's Apache Solr search infrastructure, or your own!
https://wordpress.org/plugins/solr-power/
GNU General Public License v2.0
126 stars 60 forks source link

Issue with page search because of hierarchy and id=>parent fields #520

Closed bamadesigner closed 2 years ago

bamadesigner commented 2 years ago

Our page search has been broken and all arrows point to theposts_pre_query filter in the SolrPower_WP_Query class.

The page search is different because it is a hierarchical post type. And when a hierarchical post type is searched, it uses id=>parent as the return fields parameter.

In the plugin's posts_pre_query filter, it converts "found posts" to just ID's before returning that info to core. So then core goes to map out the id=>parent and it breaks because all it has is an ID instead of a post object.

I will do a PR with the simple fix I made to correct this issue. So far I haven't discovered if this change creates any other conflicts but I will let you know if I do. I, of course, would love to know if you know of any issues with this change.

Thanks!