• Resolved chrisjp

    (@chrisjp)


    Hi,

    I’m trying to invoke Relevanssi on a custom WP Query using the relevanssi_do_query function, and it works beautifully, until I pass through a complex nested Tax Query as well, and I get the error Undefined index: field in relevanssi\lib\search.php on line 86.

    I’m fairly certain my Query Args are correct as the it does work without Relevanssi. An example of the args might be:

    Array
    (
    [post_type] => product
    [posts_per_page] => 18
    [paged] => 1
    [page] => 1
    [tax_query] => Array
    (
    [relation] => AND
    [0] => Array
    (
    [relation] => OR
    [0] => Array
    (
    [taxonomy] => product_styles
    [field] => slug
    [terms] => flock
    )

    [1] => Array
    (
    [taxonomy] => product_styles
    [field] => slug
    [terms] => floral
    )

    )

    [1] => Array
    (
    [relation] => OR
    [0] => Array
    (
    [taxonomy] => product_colours
    [field] => slug
    [terms] => Blue
    )

    [1] => Array
    (
    [taxonomy] => product_colours
    [field] => slug
    [terms] => Duckegg
    )
    )
    )

    [s] => my search term
    )

    Is this intended, not supported, or am I just doing something stupid?

    Also, I appreciate this is not necessarily intended use, but any assistance would be gratefully received.
    Chris

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yeah, looks like this is too complicated for Relevanssi. Relevanssi can’t handle this many levels of tax queries, and can’t do that (a OR b) AND (c OR d) logic.

    The solution would be to use relevanssi_hits_filter, where it will be really simple to go through the array of products and check the colours and styles to see if they match.

    Thread Starter chrisjp

    (@chrisjp)

    Hi Mikko,

    Thanks for your detailed response! I’ll have a play with that!

    Chris

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Nested Tax Queries’ is closed to new replies.