Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Mar 2010 at 19:14 UTC
Updated:
26 Apr 2010 at 23:20 UTC
apachesolr_search_view() checks if there are any POST data and only performs a search if the form is submitted. This has problems with modules that redirect to search pages. I encountered this when testing solr + ubercart search results integration (Add to cart button).
rDouglass suggested that this might be removed - posting a patch.
| Comment | File | Size | Author |
|---|---|---|---|
| apachesolr_post.patch | 3.02 KB | meba |
Comments
Comment #1
pwolanin commentedThis doesn't look quite right.
the POST check is there to avoid running the search twice when the form is submitted. Perhaps the check can be more specific?
Comment #2
Scott Reynolds commentedThen can it use apachesolr_has_searched() instead ?
Comment #3
meba commentedhas_searched() wouldn't work because the two searches happen in 2 requests (the static variable is lost).
1) Form is submitted, menu callback calls _view() function.
2) _submit() is called, redirect to apachesolr_search/$terms is performed
3) Menu callback calls _view() function.
The only solution I came up with so far is:
This ensures the search is not performed when you submit a search form. (I am solving this for Ubercart integration - add to cart button doesn't work if the previous check is there, callback function is not called).
Disadvantage: What if somebody creates his own search form?
Comment #4
pwolanin commentedI suppose one could define a variable listing form IDs. Not sure if there is a really clean solution here - the approach above looks reasaonble.
Comment #5
pwolanin commentedRobert committed a different fix here: #614644: Forms attached to Apachesolr search results won't work
follow up there or open a new issue.