Error apears when using faceted search by float fields or any other but taxonomy terms. It can be fixed by simple check if field is a link to taxonomy. I fixed this in my case by adding tho lines in file ..\sites\all\modules\search_api\contrib\search_api_facetapi\plugins\facetapi\query_type_term.inc

The lines (starting from line 60)

      if ($settings['flatten'] == '0') { 
        // Check the filters in reverse order, to avoid checking parents that 
        // will afterwards be removed anyways.
        foreach (array_reverse(array_keys($active)) as $filter) {
          $field_type = field_info_field($active[$filter]['field alias'])['type']; //!!! added
          if($field_type !== 'taxonomy_term_reference') continue; //!!! added

Comments

maxcpr created an issue. See original summary.

maxcpr’s picture

Issue summary: View changes
heykarthikwithu’s picture

Status: Active » Needs review
StatusFileSize
new926 bytes
drunken monkey’s picture

Issue tags: -facetapi plugin
StatusFileSize
new2.1 KB

Thanks for reporting this problem!
Your proposed solution isn't quite right, though, or not far-reaching enough. The problem is that, for some reason, in #2450227: Ignore parent terms in facets when operator is OR we seem to have forgotten that this query type is used not only for taxonomy terms, but for nearly all values (except dates).
Your solution has some invalid code, but most of all won't fix the underlying problem we tried to solve in the other issue for hierarchical fields that are not taxonomy terms. The proper solution is to check that a hierarchy call is present (as it will be for taxonomy terms) and then use that instead of taxonomy_get_parents_all().
Please see the attached patch, and verify that it, too, solves your problem!

PS: It seems you (like many others – it's really easy to misinterpret) are confused by the "Issue tags" field. As the guidelines state, they aren't meant for free text tags related to the issue, but only for specific categorization purposes, usually by module maintainers.
So, if you aren't sure your current usage is correct, please just leave the field empty.

maxcpr’s picture

Thanks for this patch! It seems that it works. At least not not worse than mine :)
I do not need the hierarchy in queries - so may be I didn't try to dig into it rather deep..
Hope this patch will be included in future updates!

  • drunken monkey committed 2b33674 on 7.x-1.x
    Issue #2703675 by drunken monkey, heykarthikwithu: Fixed accidental...
drunken monkey’s picture

Good to hear it works, thanks for testing!
Committed.

drunken monkey’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.