Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search Filters not Functioning
This topic contains 14 replies, has 2 voices, and was last updated by Ernest Marcinko 5 years, 2 months ago.
- AuthorPosts
- April 10, 2018 at 11:08 pm #17468
Hello,
I have set 5 category filters (from post categories) that I believe would be most used by my users. Unfortunately, when I select a filter and attempt to search for something within that filter, I am still see all site results as if I hadn’t even select a filter. Is there a setting I am missing that is needed to enable the use of the filters?
I have placed my search bar on this page that you can test: http://new.aspenxchange.com/
Thank you
April 11, 2018 at 10:13 am #17474Hi!
I haven’t been able to log-in with the details, but I think I know what you are looking for.
By default, the plugin does not exclude items, that does not belong to any category/term, as those have no connection to the filter itself.
Best,
You can change that (an other things as well) on the Frontend search settings -> Andvanced panel: https://i.imgur.com/AwfGVq1.png
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 11, 2018 at 2:21 pm #17478You cannot access this content.April 11, 2018 at 3:33 pm #17481Hi,
Thank you for that.
Okay, I checked your configuration, and the issue is a bit more complicated than that. I did not know this is actually a multisite installation, and you have lot of sites selected as the source. There are also some categories excluded under the Advanced Options -> Exclude results panel.
I believe the cause of the problem are these excluded categories, for some reason those conflict with the filter. I am not sure which one it is, but when I removed them, it started showing results. I guess there is either an ID conflict, or something I am not aware of yet.
Generally, it is not a good idea to use exclusions/filters when searching multiple multisie blog contents, as those categories does not exist on different sites, and may lead to conflicts.
I have found a possible working configuration:
– Try changing the Frontend search settings -> Andvanced like this: https://i.imgur.com/m7EPyhX.png
– And remove the exclusions, as probably one of them has a false effect: https://i.imgur.com/WX4HMzU.pngNow this configuration will have the filter active, only when at lease one item is selected, probably giving the best possible results.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 11, 2018 at 4:24 pm #17482Hello,
Thank you for your response.
Unfortunately, I need those exclusions there because they are identifying confidential information specific to certain clients that I can’t have appearing in my search results. However, if multisite is what is causing the conflict with the exclusions, I believe I can remove the multisite functionality.
Each of my sub domains (sites within multisite) are simple one-page sites. So to make these more searchable, I created a post for each sub domain that will automatically redirect to the sub domain when clicked from the main site. Each post is tagged with keywords that relate to content on it’s related sub domain so essentially I’ve set it up so that my sub domains are all searchable within my main site through posts. Because of this, I think I should be able to remove the multisite functionality without compromising the search ability of those sites. Does that sound like it might work the way I think it would?
I tested this by removing all of the blogs from the multisite settings and leaving only the main site. After saving and testing the search again, I am still not receiving any results for search terms I know are tied to specific posts.
Is there a setting I am missing that would allow me to entirely disable the multisite settings that could still be causing this issue?
Best,
April 11, 2018 at 4:52 pm #17483Hi,
I don’t think you should do that, as I am not entirely sure if that is the cause.
I did a few more experiments, and whenever an exclusion is made for a separate taxonomy (not category), then simply everything is excluded. I am not sure if this is an exception of some sort, or perhaps a yet unkonw bug.
Anyways, I have constructed a custom code, that may get around it. This script will turn on/off the empty taxonomy argument, depending if there is anything selected within the filter. Basically, by default it will allow searching everything (except the exclusions of course), then when any checkbox is checked, it won’t allow the missing terms option. I am almost certain that this should get around the issue.
Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 11, 2018 at 5:29 pm #17484Hi,
I’ve implemented the custom code you provided into my functions.php file and unfortunately it doesn’t seem to have had an effect.
Please let me know what you think the next step should be. I appreciate your time.
Best,
April 11, 2018 at 5:33 pm #17485I apologize, I responded too quickly.
With your custom code implemented, it is now allowing results to appear when a filter selection is not made. Once I select a filter and enter a search term, that I know is used as a tag on content in that filter, it is still not showing any results.
Hopefully this helps you identify the issue with the filters.
Best,
April 11, 2018 at 5:43 pm #17486Well, that didn’t work, I am probably missing something there, but I don’t know what exactly.
Can you add temporary FTP access, so I could debug the search query, and make changes to this code in the theme functions.php file? I might be able to figure it out.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 11, 2018 at 5:52 pm #17487You cannot access this content.April 11, 2018 at 6:06 pm #17488That is a clever solution. Unfortunately I can’t see that menu, I think my account does not have priviliges to it. Can you please check that as well?
I will try avoiding using the FTP, unless neccessary. The Snippets plugin might be sufficient.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 11, 2018 at 6:16 pm #17489You should have access to that plugin now.
April 11, 2018 at 6:37 pm #17490Thank you! I think I got it. I had to make a modification to the code. Now I am seeing post results whenever I am clicking a filter, nothing else. If nothing is checked, then it searches everything it should.
For future reference, the mofified solution is this:
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 11, 2018 at 6:46 pm #17491Fantastic, it is working wonderfully. Thank you
Because of the custom code, are there any settings I should not alter withing the search instance settings?
Thank you for solving this!
April 11, 2018 at 6:48 pm #17492You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.