Saving a search does not work. Saved search URLs contain no query parameters. They simply link to the View page.

Steps to reproduce:

  • Execute a search using a View page.
  • Using the "Save Search" block, save a search.
  • View saved searches in user profile. Searches link to the View page without any query parameters.

More information:

Path to View page:

/plan-search

Path after executing a search on View page:

/plan-search?f[]=field_product%253Afield_hp_bedrooms:1

  • Drupal core version: 7.54
  • Using search_api_solr module version: 7.x-1.9
  • There are no log messages.

Let me know if I can provide more useful information. This bug breaks the modules purpose completely.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maskedjellybean created an issue. See original summary.

maskedjellybean’s picture

Issue summary: View changes
drunken monkey’s picture

Status: Active » Postponed (maintainer needs more info)

Are you maybe using AJAX views, or some other means of just loading part of the page? This looks like the "Save search" block would be created in a previous page request, where the view doesn't have any filters.

Another possibility would be block caching going wrong there, though it seems unlikely unless you have a (buggy) custom caching solution in place. But please see if the attached patch fixes your problem. (Or do you maybe use something like Panels for displaying the "Save search" block, instead of Drupal's regular block system?)

drunken monkey’s picture

(Forgot to attach the patch.)

danthorne’s picture

Patch didn't work for me. Issue I have is when using ajax_facets as a widget.

danthorne’s picture

I'm guessing that it is because the ajax_facets query is f[]=field_filter:38 rather then f[]=field_filter=38

danthorne’s picture

Actually I don't think thats the issue. It seems that f[0] at the start is replaced with f%255B0%255D which saved search doesn't like.

danthorne’s picture

Sorry, after more testing I think it is because ajax_facets url looks like f[], if I append f[0], f[1] ..etc the saved search works.

I'll see if theres any way to change this with ajax_facets.

rjacobs’s picture

If this is specific to core >= 7.55 I suppose it may be related to the known issue about URL generating functions:

https://www.drupal.org/project/drupal/releases/7.55

Search API saved searches links generally depend on the query string to properly pass filter args, and, for some setups at least, these are encoded as an array in the URL. So I think that core issue may apply.

Nikolay Shapovalov’s picture

I have same issue. I think problem is at SearchApiSavedSearchesViewsHandlerFieldName::render_text().

I think the reason that in some facet name colon ":" is used.
Working link I have from facet on search page
f%5B0%5D=user%253Alast_login%3Alast_3_months
After url decode it converts to
f[0]=user%3Alast_login:last_3_months

Broken link from saved search page:
f%5B0%5D=user%3Alast_login%3Alast_3_months
After url decode it converts to
f[0]=user:last_login:last_3_months

I think we need to change how url is generated.

Nikolay Shapovalov’s picture

Assigned: Unassigned » Nikolay Shapovalov
Status: Postponed (maintainer needs more info) » Needs work
Nikolay Shapovalov’s picture

Nikolay Shapovalov’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
6.14 KB

I provide patch. I change way params added to query. And overwrite views_handler_field::render_as_link function, this is simple patch apply https://www.drupal.org/files/issues/2909709-7.patch.

Nikolay Shapovalov’s picture

Assigned: Nikolay Shapovalov » Unassigned

drunken monkey’s picture

Status: Needs review » Fixed

Thanks a lot for the patch!
As this seems to be quite a different issue than the one originally reported, I think you should have rather created a new issue instead of resurrecting this one, but as your patch seems to work fine (and there doesn’t seem to be a chance that either Views or Drupal will fix this yet for D7), I’ll just commit this.
Thanks again!

Status: Fixed » Closed (fixed)

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