This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

How do I combine search criteria?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How do I combine search criteria?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #47568
    dot832dot832
    Participant

    Hi,
    My search criteria has several options.
    1. Search by company
    2. Filter by category
    3. Search by state

    How can I join the search options by an AND condition? I am especially interested in being able to join the checkboxes with the search by state dropdown.

    Please advise.

    Thank you.

    #47589
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Sure!

    By default all criteria must match, so they are connected via an AND logic, but there are a few things that can affect that.

    I recommend this exact configuration: https://i.imgur.com/4v5Bxzg.png
    This will ensure that all criteria must match, as well as no matches from unset field values are allowed. (posts without taxonomy terms, or any missing custom field values)

    #47593
    dot832dot832
    Participant

    Hi,
    I don’t think this is the correct configuration. Here’s why.

    If I only check Annuals there are no results but there should be approximately 14.

    If I check Annuals and select the state of Utah there is one result which is correct

    If I only select the state of Utah there is one result which is correct.

    I need to be able to use all fields in an AND relationship but show results when only one is used.

    #47595
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Okay, in that case I think it’s still the correct one, aside from one minor change: https://i.imgur.com/94p5OO5.png
    This will ignore the unchecked values from the checkbox, and will force to match at least one of the checkboxes.

    #47597
    dot832dot832
    Participant

    OK. I feel stupid. It’s still not working.

    #47600
    Ernest MarcinkoErnest Marcinko
    Keymaster

    From looking at the front-end I think it might be the “Search by state”

    The first value is set to “none” – which does not match anything. The filter value should be emtpy, and my guess is that currently it looks something like none||Select a state. On the custom field filter setting, edit the “Search by state” and make sure the first value is changed to this:

    ||Select a state

    #47601
    dot832dot832
    Participant

    Got it! Thank you very much!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.