When visiting a search page, I get lots of the following messages:

# Warning: Invalid argument supplied for foreach() in search_api_facets_paths_url_outbound_alter() (line 100 of …/search_api_facets_paths/search_api_facets_paths.module).
# Notice: Undefined offset: 1 in search_api_facets_paths_url_outbound_alter() (line 98 of …/search_api_facets_paths/search_api_facets_paths.module).
# Notice: Undefined index: f in search_api_facets_paths_url_outbound_alter() (line 101 of …/search_api_facets_paths/search_api_facets_paths.module).

One effect of this is that all facet links are rewritten, not only those of taxonomy terms — and they are rewritten to have no effect at all. The attached patch should fix this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Shadlington’s picture

I also get:
"Warning: Invalid argument supplied for foreach() in search_api_facets_paths_url_outbound_alter() (line 100 of /var/www/sites/all/modules/search_api_facets_paths/search_api_facets_paths.module).
Warning: Invalid argument supplied for foreach() in search_api_facets_paths_url_outbound_alter() (line 100 of /var/www/sites/all/modules/search_api_facets_paths/search_api_facets_paths.module)."

EDIT: Actually its way more than just that, depending on the search...

Shadlington’s picture

Applying that patch stops the warnings but then nothing happens when I click on a facet. The url is appended to but the search results are unaffected.

miiimooo’s picture

Status: Needs review » Fixed

Added to 7.x.-1.4

Shadlington’s picture

Status: Fixed » Needs work

As I said in #2 this only fixes the warnings.
The facets stop working though, and only append onto an ever-expanding url without ever actually filtering the results!!

drunken monkey’s picture

As I said in #2 this only fixes the warnings.
The facets stop working though, and only append onto an ever-expanding url without ever actually filtering the results!!

This still happens for you? I could neither reproduce this before, nor can I reproduce it now, so probably Michael will need additional information for analyzing / fixing this. Most importantly: do all facet links stop working, or only those for taxonomy terms?

Shadlington’s picture

Its just the taxonomy terms.

EDIT: This was a stupid post. No, really. Stupid.

drunken monkey’s picture

No, I can't reproduce this. And the ID-based ones of course still work, as they aren't rewritten, yet.
Once the issue you linked is committed, this module should probably be adapted to also support those facets.
Why the patch would make this module unnecessary, I don't know, though – the URLs generated by the Facets module use GET parameters in any case, after all. And in the case of directly indexed taxonomy terms, they'll even contain the TID instead of the name, which is even worse.

Shadlington’s picture

Oh bugger - ignore #6 as its really just rubbish.
EDIT: I initially made a long-winded explanation of why I said what I said in #6 but it doesn't really matter and just confuses issues. The point is it was garbage and should be ignored. Sorry!

Back to the point now and I haven't got a clue why this isn't working then.

It only happens to Taxonomy >> Name facets - i.e. the ones that it is attempting to rewrite.
And it only happens on paths that it has been enabled for.

Trying to work out if there's anything else to it now...

Shadlington’s picture

EDIT: I thought I'd found out what was going on but I was wrong.
Blehhh.

Shadlington’s picture

EDIT: Wrongwrongwrong.

Shadlington’s picture

EDIT: Blah wrong issue >_<

...This is not going well for me.

Shadlington’s picture

Just seen your email Michael, I'll give you access to my test site and email the details.

miiimooo’s picture

Okay one thing I notice is that we're using different versions of Search API. For instance, the version I'm using uses Fulltext or String for taxonomy term names and has no special Taxonomy term field type. I can't see your version number so here's my list:

Search API	7.x-1.0-beta7
Search facets	7.x-1.0-beta7
...

It's all 7.x-1.0-beta7

Shadlington’s picture

Ah. I'm on the latest dev version.
Also, those special term fields are do to a patch that I forgot to rollback before giving you access - I assure you that the problem occurs even without it.

Hold on, I'll roll it back.

miiimooo’s picture

Status: Needs work » Closed (works as designed)

Okay it's not the version but more about your label issue. For Pretty Paths to work you need to use the Category >> Name facet. The ID based ones don't work. Probably should document this. Your Multi and Single test are working too - maybe because I ran the re-index from the Search API menu.

Shadlington’s picture

Status: Closed (works as designed) » Needs work

Awww crap. I'm gonna have to create a new index again. Hold on.

EDIT: Sorry, that was a cross-post. But that isn't right, the ID ones weren't what I was testing, they were for something else. It was the >> Name ones I have the problem with. One of them works (Tag) but the others don't.

And I'm in the process of rolling everything back to an earlier version, bear with me.

Shadlington’s picture

Here we go. Try again.
I'm now back on the beta7 version, no patches.
You should see what I see right away - the last facet block (Tags) works but the other 3 don't.

miiimooo’s picture

It's the space in the vocabulary name. I hadn't tested with that.

Shadlington’s picture

o_O

Phew.
That makes sense.
I figured there had to be something different between those 3 and the one that worked... Didn't twig that a space could be the cause.

Its a huge relief to have an answer - this was seriously bugging me!!

Thanks Michael

miiimooo’s picture

Status: Needs work » Fixed

fixed in 7.x-1.6

Status: Fixed » Closed (fixed)

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