Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert search criteria into a filter #126

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Convert search criteria into a filter #126

wants to merge 4 commits into from

Conversation

peussen
Copy link

@peussen peussen commented Jul 20, 2015

I ran into a problem with my site, which after a couple of hours searching i tracked down to how this plugin worked in combination with another plugin. It appears the other plugin (which i will ask for a fix as well), does some queries in the pre_get_posts, which screws up this plugin.

Basically what happens is that a plugin does some queries in the pre_get_posts to determine if it should do something. These queries do appear to be the main_query, even though they are not. I guess you ran into somewhat similair problems (looking at the attempted variable).

So to allow other people with similair problems to correct this i introduced this filter. Basically you will get one filter per search type. So you should get:

  • elasticsearch_should_query_search
  • elasticsearch_should_query_tag
  • elasticsearch_should_query_archive
  • elasticsearch_should_query_taxonomy
  • elasticsearch_should_query_search
  • elasticsearch_should_query_category

People can then add their own criteria (or remove the default ones) when needed.

If you have some alternative solution i could not think of, which will not require this pull request, please let me know!

peussen added 4 commits July 20, 2015 09:30
…ed or not. This allows users to circumvent any faulty plugins which cause this plugin to fail
…ed or not. This allows users to circumvent any faulty plugins which cause this plugin to fail
…bel/wordpress-fantastic-elasticsearch into prevent_multiple_main_query_issues
@peussen
Copy link
Author

peussen commented Jul 20, 2015

I'm looking into one test scenario right now which seem to act up. If that one is due to this change, i will cancel this request. P

@peussen peussen closed this Jul 20, 2015
@peussen
Copy link
Author

peussen commented Jul 22, 2015

Looks like the test failure on my side was caused by something else. All tests work for me now.

@peussen peussen reopened this Jul 22, 2015
*
* @return string
*/
function get_filter_name() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a fan of having filters depend on class names, as they can change at any time. better to maybe put common logic in abstract and have child classes call it instead with its own name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants