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

Excluding terms from taxonomy removes to many

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Excluding terms from taxonomy removes to many

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #57262
    Steve StruttSteve Strutt
    Participant

    Excluding terms in my hierarchical taxonomy under the frontend search settings options additionally filters out unrelated low level terms.

    I have a 5 level location taxonomy: Country > County > Town > Area > Road. We have discussed the limitions of the ASP support for displaying hierachical taxonomies before, as I have 450 terms nested 4 deep. Ideally I need the checkbox option to allow folding and unfolding of the levels of the hierarchy.

    Without the checkbox support, I thought I had found a solution to simplify the long list of displayed terms. I exclude all Country and County terms. Leaving only the 3 lowest levels of terms are displayed. (Town > Area > Road)

    This is working showing just the Town > Area > Road terms and their structure, as in figure 1 in the ASP dropdown. But, I have just noticed that some of the lowest level road terms are missing. Some ‘Area’ terms are showing no Road terms, when there are terms existing. See figures 2 and 3. The first is the ASP display, the areas Bellfield, Bowerdean and Carver Hill are not showing any Roads. The second image is the ACF terms list, where these are present. I cannot see any difference between the terms that are displayed and those that are not. There are other ‘areas’ that display roads OK, as in figure 1.

    What looks to trigger this behaviour of excluding the lowest level terms is the exclusion of the two top-level terms, UK and Bucks, under which all these terms are nested. If I exclude UK by itself a few low level Road terms are lost. If I include ‘Bucks’ as well, more Roads disappear, leaving several of the Areas without nested roads. Including these two terms, displays all the Road terms as expected. But the

    To me, it is not obvious why this only affects some of the Road terms, but not others. It looks likely that the search algorithm scanning the terms to exclude is making false matches based on the retrieved taxonomy data.

    #57274
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    My guess is that the higher level term is not associated with any posts only the lower level ones? That may explain the issue, WordPress gets a bit funky when returning the terms list, it tends to exclude parents when all their child terms are also excluded.

    #57276
    Steve StruttSteve Strutt
    Participant

    Curious, WordPress shows that both the top level terms have records directly associated with them. Other than a malformed data structure when WordPress is retrieving terms, I cannot think of any programmatic way only some of the lowest level terms would be excluded if the top level terms are excluded.

    As I am not using these two terms, for the incorrectly showing branches, I flattened the hierarchy and moved the root of these branches to the top level. All the lowest level terms now show as expected. The taxonomy has a weird structure now, but it works.

    Related, is there any progress on the new styling of the filters? I implemented your solution for an options drop down to change the results sort order. It works well, but getting the styling of the drop down to be the same as the other filters took longer than implementing it.

    #57285
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Very interesting, I have no clue whatsoever why is it happening. Could be some sort of a weird bug somewhere, but the plugin requests the terms from WordPress internally in the first place, so it may actually be something in the WP core.

    The back-end redesign is going slowly but surely. Recently the search cache and the search statistics interfaces were rebuilt. Next comes the rest of the menus and finally a completely new search configuration interface – in fact it is going to be separated to 3 different “template” areas, one for the search bar, one for the filters and one for the results – and each different search/filter/result configurations can be paired with each other.
    It is still a long way to go though, no estimate at this time.

    #57291
    Steve StruttSteve Strutt
    Participant

    Thanks for the update. With the change to the taxonomy structure and the example you provided for implementing a sort order frontend dropdown, my site is working well enough to go live.

    If the redesign of the filters can include consistent styling across all the different dropdown types, it would be beneficial. I can wait.

    #57296
    Steve StruttSteve Strutt
    Participant

    Hi Ernest, an additional question related to the missing terms in the dropdown list. How are the terms that I exclude from the taxonomy removed from the filter dropdown?

    If they are removed by ASP before passing the list to WordPress, is ASP correctly determining the list of terms to pass? Is there any way of determining the list passed to WordPress? I ask because I noticed that only two of the exclusion terms affect the list of terms returned. One removes the expected top level term, but in error also removes a few child terms. Curiously the excluded top level term ‘UK’, causes the child term ‘Union Street’ to be removed. The second term, ‘Bucks’, causes more to be lost. The issue seems to be with the way the search of excluded terms is performed against the full list of terms.

    #57298
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi Ernest, an additional question related to the missing terms in the dropdown list. How are the terms that I exclude from the taxonomy removed from the filter dropdown?

    Basically their IDs are passed along to be excluded from the get_terms() function call via a paramater. So the list is requested from WP first, then processed further.

    #57299
    Steve StruttSteve Strutt
    Participant

    Thanks. Its a WordPress issue then!

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