We established #1777714: Don't modify the query path to cleanly generate pretty paths. Therefore Search API committed the necessary patch in #1777710: Remove dependency on $_GET['q'] for determining base paths that changes Search API base path determination from $_GET['q']
to 'href' of menu_get_item()
.
Unfortunately this causes trouble for others: #1827272: Facet path can be incorrectly returned stated that when for example using panels with dynamic arguments, those should be part of the base path, but they wouldn't be using menu_get_item()'s href. So in the end, basically #1777710: Remove dependency on $_GET['q'] for determining base paths was reverted and it is up to Facet API Pretty Paths to figure out another way to handling things.
We want Search API to correctly work under the following premises:
- base path as configured in search_api_views
- base path as configured using panels with optional path arguments (those should be part of the base path)
- path arguments as created by facetapi_pretty_paths (those should stay out of the base path)
Our current workaround is just applying the patch from #1777710: Remove dependency on $_GET['q'] for determining base paths in order to make pretty paths work but we don't want to rely on patching Search API in the future.
Comment | File | Size | Author |
---|---|---|---|
#36 | fix_base_path_issues-1861786-36.patch | 490 bytes | geerlingguy |
#23 | facetapi_pretty_paths_segment_fix.patch | 862 bytes | dasjo |
#11 | 1861786_facetapi_base_path_11.patch | 3.39 KB | dasjo |
#7 | 1861786_facetapi_base_path_7.patch | 2.9 KB | dasjo |
#7 | facetapi_pretty_paths_test.zip | 9.85 KB | dasjo |
Comments
Comment #1
dasjotalked to DamZ & nick_vh
DamZ suggested, this should be as easy as putting a
$query_options['search_api_base_path'] = $this->view->get_path();
somewhere in searchapi_viewsnick_vh showed how apachesolr handles this
http://pastebin.com/1j4Bcnpq
i have created a patch for search api that incorporates the suggestions from DamZ: #1863866: Make sure base path is set correctly for search api views
thanks for reviewing
otherwise we might put that code in some hook_views_post_execute within facetapi_pretty_paths
Comment #2
khiminrm CreditAttribution: khiminrm commentedHi! Is there a solution for Search pages module? I've made such modifications as temporary solution for our site with search page's path 'search/site':
in adapter.inc for function getSearchPath():
in url_processor_pretty_paths.inc for function setBreadcrumb() :
Maybe anyone know a method for Search pages module to get all it's paths? Then we can compare them with $item['href'] and add argument if needed.
Comment #3
dasjoad #2: have you tried the views patch from #1863866: Make sure base path is set correctly for search api views ?
edit: i have updated the views patch to use
get_url()
instead ofget_path()
in order to include views arguments.Comment #4
khiminrm CreditAttribution: khiminrm commentedNo, I didn't try this patch, because I thought it is related only to Search API views not to Search pages module. Ok, I'll try it.
Comment #5
khiminrm CreditAttribution: khiminrm commented@dasjo, I've tried your patch http://drupal.org/files/1863866_search_api_views_base_path_url.patch. For my search page which is created with Search pages module (ver. 7.x-1.0-beta2 ) the patch didn't help - the facet links doesn't contain search key. And in my catalog page which is created with Search API views the current search block's links and breadcrumbs don't work - their links have a current path.
Comment #6
dasjo@khiminrm: yes, sorry i didn't recognize that search api pages doesn't use search api views.
for this case, we need to figure another way to make sure that
FacetapiAdapter::getSearchPath()
returns the right base path.Comment #7
dasjoafter some further debugging, i believe the sanest way to handle things is setting the base path internally.
there are just too many things playing into this: views, search api, panels, arguments, ...
the attached patch already worked for me with recruiter job search.
second test case was creating a panel page with a search string as dynamic argument. this works as long as the search string is present, otherwise it will interpret the first pretty paths argument as search string. if you want to play around with this, find the necessary configurations exported using features in the attached zip file.
@khiminrm: i hope this approach also solves your problem, please tell me about your findings
Comment #8
dasjoComment #9
khiminrm CreditAttribution: khiminrm commented@dasjo, I've tested your new patch. All work fine! Only first facet api breadcrumb on my search page doesn't contain search key in url. Other breadcrumbs contain search key. On my catalog page (search api views) the breadcrumbs are fine.
Comment #10
khiminrm CreditAttribution: khiminrm commented#9 is fixing for me by replacing
with
Comment #11
dasjokhiminrm: glad that this works for you and thanks for spotting the breadcrumb issue. this particular code wasn't written by me so i have to admit that i'm a bit unsure about it. your fix worked for me, so i have included it in the patch
Comment #12
dasjoi have tested this patch for a pending upgrade of Drupaljobs:
- #1863866: Make sure base path is set correctly for search api views isn't useful anymore, actually you shouldn't use it because it won't allow you to deselect facets in certain cases.
- added some logic to support the
search_api_base_path
settings of search_api.committed:
http://drupalcode.org/project/facetapi_pretty_paths.git/commitdiff/3ff36...
http://drupalcode.org/project/facetapi_pretty_paths.git/commitdiff/04f1f...
hope this works for everybody :)
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm getting facet paths like //category/tools and it breaks the site.
<a href="//category/Boots" class="facetapi-inactive" id="facetapi-link--124">Boots <span class="count">(17)</span><span class="element-invisible"> Apply Boots filter </span></a>
The new basepath logic returns empty, so instead of /search/, I get //
Using Search API Views for my /search page
Using latest Search API 7.x-1.4 and latest FacetAPI Pretty Paths
Comment #14
dasjo@morningtime: can you give the steps to reproduce the problem or provide a features export to reconstruct your setup?
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous commentedI'll have to dive into this.
For now I can only say that
public function getBasePath()
returns empty.$this->basePath;
is never set.Will get you more info asap.
Comment #16
dasjo$this->basePath
should be set inFacetapiUrlProcessorPrettyPaths::fetchParams()
, line 114 of url_processor_pretty_paths.incComment #17
Zac_JH CreditAttribution: Zac_JH commentedHi
I can report the same as morningtime with the basepath coming back empty. I did a complete fresh install and the facetapi module does not contain the url_processor_pretty_paths.inc
Comment #18
dasjowell, here you go
http://drupalcode.org/project/facetapi_pretty_paths.git/blob/refs/tags/7...
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedHI all,
I have the same problem. Replaced inc with the one from #18 but the constructed URLs are still missing the base path/domain name. Using beta1.
I tried with and without $base_url set, doesn't make a difference.
Comment #20
dasjo#18 just references the file that ships with beta1.
if you are having problems please help us debug, for example by stating your exact setup: views export, which path are you accessing ($this->fullPath) and what is assigned to $this->basePath.
Comment #21
jbekker CreditAttribution: jbekker commentedWith FacetAPI Pretty Paths Beta 1, Search API 1.4, I don't get a base URL but just the arguments in the url. "//categorie/accessoires-1" instead of "/products/categorie/accessoires-1".
I would like to help, just not sure where to start with debugging.
View Export
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedOK I try my best in putting together some useful information. If you would like to know something else, just let me know.
- I use a view which uses the path "feed" and it is set as the frontpage in drupal (meaning the actual URL is "/")
- $base_url is not set
Versions
View Export
The object ($this before return in fetchParams):
Comment #23
dasjothis seems to be a problem when the url contains an uneven number of parts, because the last part will get dropped.
the attached patch should fix that problem and has been committed: http://drupalcode.org/project/facetapi_pretty_paths.git/commit/4062cd9
please report if that solves your problems
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedPerfect, #23 seems to fix the problem on my end. URLs are now generated correctly and the module is behaving nicely. :-)
Thank you!
Comment #25
dasjothanks for testing, glad it works :)
morningtime, roodoo, jbekker - would be great if you can provide feedback as well. i'd like to roll another beta soon, so people don't run into this bug
Comment #26
Zac_JH CreditAttribution: Zac_JH commentedPatch from #23 applied and it works perfectly, thanks for the quick turn around dasjo - great job.
Thanks genox for getting info too.
Comment #27
jbekker CreditAttribution: jbekker commentedWorks for me as well!
Comment #28
Anonymous (not verified) CreditAttribution: Anonymous commented#23 solved my issue!
Comment #29
Anonymous (not verified) CreditAttribution: Anonymous commented#23 works for me as well! Thanks!
Comment #30
dasjogood to hear. this has been fixed in beta2:
http://drupal.org/node/1896740
please help me keep the issue queue clean open follow ups as separate issues :)
Comment #31
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks. I have just installed the Beta2 but I see a different behavior, maybe not related to this patch. Now the facet value is in the following format "termname-id". So for example if I want to filter for "Football" in the group "Sports" the URL is in the format : /sports/football-12
is this the correct behavior? Am i missing something?
Comment #32
dasjoconnor23, please open a separate issue and explain you behavior before and how it has changed.
Comment #33.0
(not verified) CreditAttribution: commentedup
Comment #34
dasjoThere's a new fix for Search API: #2159827: Fix search base path in Facet API adapter.
Also see #1981578-20: Allow to remove "Taxonomy Vocabulary" from urls
Comment #35
geerlingguy CreditAttribution: geerlingguy commentedAnother note: on one site using the Apache Solr Search Integration module (not Search API), facet links are broken after this module's alpha9 release for searches where no keyword is entered.
For alpha 9 and earlier, if a user enters no keyword on a custom search page like '/search/recipe', the facetapi links would be something like:
But with beta 1 and later, the links would be something like:
The Apache Solr search integration module seems to use that third URL parameter as the 'keyword' value, so not having an extra slash in there breaks that module's usage with Facet API Pretty Paths. It looks like a lot of the base path logic inside url_processor_pretty_paths.inc changed with this patch/beta1, and I can't find a quick/simple way to patch it and get it working again.
Comment #36
geerlingguy CreditAttribution: geerlingguy commentedHere's a patch that seems to fix the base path issues for me (using Apache Solr Search Integration module). It pre-constructs the base path using
getSearchPath()
, which was done up to beta1, but was discarded. I don't think this will fix all the other problems related to this particular issue, but at least it allows me to use the latest version of the module instead of alpha9 :)Comment #37
dasjoi'd like to see if we can get this fixed during drupalcon amsterdam.
anyone willing to share what they are currently using?
Comment #38
kopeboy CreditAttribution: kopeboy commentedsearch_api 7.x-1.13
search_api_solr 7.x-1.6
search_api_facetapi 7.x-1.13
facetapi 7.x-1.5
facetapi_pretty_paths 7.x-1.1
Using only Views pages of 3 different Search indexes (on Pantheon's apache solr server), with no contextual filters nor Content panes or Contexts cause I wasn't able to make them work :/ but of course, they would be much needed.
Comment #39
torgosPizzaWe're using:
Acquia Search for Solr 7.x-2.14
Apachesolr 7.x-1.7
FacetAPI 7.x-1.3
FacetAPI Pretty Paths 7.x-1.1+1-dev
(Apachesolr Views 7.x-1.0-beta3 but only on one page)
This combination seems to work pretty well for me!
Comment #40
jcisio CreditAttribution: jcisio commentedApachesolr 7.x-1.7
FacetAPI 7.x-1.3
Could we commit first then fix for Search API later?
Comment #41
dasjothanks you everybody for your feedback & thanks for the patch geerlingguy!
as i don't want to break things for either search api, apachesolr users and we haven't found a clear strategy on fixing the base path issues yet, i decided to take a more flexible approach to this.
#2413319: Add base path provider plugins makes this configurable and allows developers to create their own base path strategies using plug-ins.
would love to get your feedback there.