Forums Forums Search & Filter Pro Selected more than one checkbox error

Viewing 10 posts - 11 through 20 (of 21 total)
  • Ross Moderator
    #16959

    Hey Ian

    Ok so I managed to have a look around….

    A couple of things.

    To test your theory I did this search :
    [pasting link in following private message – want to keep this post visible for other users]

    Which is working fine with an OR relationship (I set one of the posts to African-American, and one to Chinese) – but as you now mention, the problem only happens when you select a lot of options.

    What you might not know about meta queries (and custom fields) is that they have the potential to create very slow queries – basically, they’re inefficient.

    WordPress is optimised to make queries with taxonomies lightning fast, but queries/setups in general with meta data should be used sparingly. On top of that, when you have complex custom fields (like checkboxes, where the field can contain multiple values), then the data is serialised – serialised data & searching is very bad – and almost almost impossible to do accurately and without huge overheads/demands on your server.

    Another disadvantage of having serialised data is, the only way to search using these fields is to use a wildcard search – this means your results may not be 100% accurate either (if you want to know a little more about this I explained this to another user: https://support.searchandfilter.com/forums/topic/duplicate-search-results/page/2/#post-12508).

    So my first piece of advice is, if you must use a custom field, try not use use the checkbox type in ACF – try to use types where only one value may be selected at a time (such as radio, or select).

    BUT, what I would really suggest for you to do is convert all your searchable options to custom taxonomies – I’m assuming you have some knowledge of them (they’re just like tags and categories), but if not I can point you in the right direction.

    So you would have a custom taxonomy for each of these: Ethnicity, Religion, General, etc etc…

    I think you could create a search form that has the exact same options but using custom taxonomies instead. This would make your searches quicker and more accurate.

    The final cherry on the cake with custom taxonomies is, in S&F 2.0 (coming out soon), these will be dynamic – so if you selected “African American” in ethnicity, then other options from the search form would be removed that are no longer available – a kind of drill down effect!

    Well, hope you enjoy long messages (I don’t 😉 )

    Thanks

    Ross Moderator
    #16960
    This reply has been marked as private.
    Ross Moderator
    #16961

    After all that Ian I just realised your intial problem

    So, converting to custom taxonomies will solve your issue but I misunderstood it in the first place (please do still take advice from above though).

    Essentially you want to have an “OR” relationship between your meta fields – this is actually not yet an option in S&F – if you take a look at the “tags, categories and taxonomies” tab, there is an additional relationship setting – this also needs to be implemented under the “post meta” tab.

    Thanks

    Anonymous
    #16969

    Hi Ross,

    Thanks for taking a look. The client requested a search form that the user could pick any and multiple items for so I had to build to that. I’ll look into the custom taxonomies and let you know how I get on.

    Many Thanks.

    Ross Moderator
    #16971

    No worries – I think you’ll be able to achieve the same effect with them 🙂

    Anonymous
    #17003

    OK I’ve got it now. I added some custom taxonomies to test. The only issue now is they are not displaying in the search form, even though I added them and loaded the correct shortcode.

    If they would show I’m sure my search would work fine.

    Same login details as above if you need to take a look.

    Anonymous
    #17037
    This reply has been marked as private.
    Ross Moderator
    #17040
    This reply has been marked as private.
    Ross Moderator
    #17161
    This reply has been marked as private.
    Ross Moderator
    #17178
    This reply has been marked as private.
Viewing 10 posts - 11 through 20 (of 21 total)