Needs work
Project:
Apache Solr Search
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2011 at 15:59 UTC
Updated:
19 Feb 2018 at 22:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
nick_vhCould you see if this fixes it for you?
Comment #2
brianV commentedWorks on the custom search pages after a cache refresh, but doesn't appear to be working on the core_search page.
Comment #3
nick_vhThis should fix some notices that happen when you clear the cache
Unfortunately I'm a bit in the dark regarding the core search title so will revisit this in a later time.
I'd suggest you do an easy menu_alter to change this.
Comment #4
brianV commentedThanks - this does indeed fix the notices.
Comment #5
nick_vhComment #6
nick_vhComment #7
pwolanin commentedcommitted
Comment #8
brianV commentedNoticing the change to 'fixed' - is the core search page fixed as well?
Comment #9
nick_vhThe core search won't be fixed in this issue. This problem has an easy fix for site developers that are able to do a quick hook_menu_alter. I think this is more a core search problem since it is not taking the title from the only available search engine in to account.
Maybe you can try to find a similar issue there?
Comment #11
brunogoossens commentedThe patch didn't work for me, so I added an extra line.
Comment #12
nick_vhI'm sorry but that is not how it is done.
Try to clear your cache and see if the title was adjusted?
Please give us some pointers on how to replicate and we'll see if we can replicate it!
Comment #13
jordanmagnuson commentedThe title given in the settings page is still being ignored for Apache Solr default "core_search": title is always "Search" (though settings title is working for non-default Apache Solr pages). Am I reading you correctly that this is not going to be fixed?
How can I change this with a hook_menu_alter? I've tried the code below, but it doesn't seem to be working (caches cleared, etc.)
Comment #14
mindbat commentedWith the latest version of the Apache Solr module (7.x-1.0-rc3) this bug is still occurring for user-defined search pages.
The patch given above seems woefully out of date: the line numbers are all wrong, and the patch fails when I try to apply it.
Is there a plan to fix this in a newer version of the Apache Solr module? Does anyone have an up-to-date patch for this bug?
Comment #15
mindbat commentedFound a fix that worked for the latest version.
I've attached it as a patch.
Comment #16
mindbat commentedComment #17
subhojit777This does not work for "%value" replacement pattern.
If I set Search results for %value, then the page title becomes Search results for %value.
This should have been Search results for search term
Comment #18
pwolanin commentedPerhaps you should be using a title callback. drupal_set_title() is generally not the optimal way to do this.
Comment #19
subhojit777I fixed this by replacing %value with search keys. I will see if I create a patch and upload here.
Comment #20
nick_vhComment #21
pwolanin commentedIn fact, this should already be handled via title callback, so this is the wrong approach
Comment #22
pwolanin commentedok, so somehow the initial menu rebuild doesn't set the right values I think. Try a cache clear or save the page again.
This little patch might make the process more reliable?
Comment #23
pwolanin commentedHere's a fix to use a title callback for custom pages so %value can be used.
Comment #24
pwolanin commentedcommitted to 7.x
Comment #25
luco commentedhi, has this solution been implemented yet? I got 7.x-1.3, from 2013-Jun-11, and this bug still exists.
cheers
Comment #26
niccolox commentedI tried #23 with 7.x-1.4 and it didnt seem to work for me
I am working with a Nutch 1.6 > Solr 3.62 via Nutch Multisite / Apache Solr Examples solution
Comment #27
niccolox commented#23: 1314664-23.patch queued for re-testing.
Comment #29
rooby commentedI'm not sure why the title of this issue was changed in #23.
The issue as far as I see it (7.x-1.4 - I haven't checked 1.5 yet) is that the title field is not used at all and I'm not even using the %value.
I have tried clearing all caches and the title still just says "Search" all the time.
There are also other reports of this not being fixed after the commits.
Comment #30
swarad07I am using the latest 1.6, I can't see the title field working at all, forget the %value usecase. The title just shows Search that's it!
Comment #31
Daemon_Byte commentedI can confirm the issue still exists in 1.6. Will try and see if I can find some time to look into it.
Comment #32
Daemon_Byte commentedOk I can't find out the cause but in the menu_links table I had 2 entries for the page. One with the title that contained %value and another that contained the title of %. Drupal was using the 2nd which meant no %value to replace. Once I deleted the wrong link from the table it all worked.
Comment #33
rooby commentedChanging title as per mine and other peoples findings.
Comment #34
andy_w commentedI thought I would just mention my resolution to this issue, and possibly the reason behind it's irregular occurrence, when the path is prefixed with search e.g. "search/your-search-name" the menu is defaulting to the base search route, so changing this to "your-search-name/search" seems to resolve this.
Comment #35
rv0 commentedthe observation above in #34 is correct
Is there a temp workaround for this that does not require changing the path? I can't change the path at this moment because a lot of custom code/theming depends on it.
Comment #36
Daemon_Byte commentedrv0 have a look in the db like I suggested in #32. That worked for me. Maybe it will for you?
Comment #37
stefan.r commentedThis patch fixes the core search title issue in #2, #3, #9, #13, #30 by checking whether apachesolr_search is the only active search module (in which case there are no tabs, and so the title from the default search page should not show up).
It also adds a
%termsparameter in case we want to show the search terms in the title, as #17 and the current wording on the admin page were suggesting that is what%valuedoes. This as in @pwolanin's patch%valuejust displays the value of%in the path (ie. the term name/user name), not the search term.Comment #38
stefan.r commentedComment #40
stefan.r commentedComment #41
nick_vhLooking good! Committed to 7.x-1.x and needs backport to 6.x-3.x
Comment #42
nick_vhComment #43
cristiroma commentedNot sure if need to report here, but this patch has a bug. See https://www.drupal.org/node/2333447 (If you have more than a page will not show)
Comment #45
Angry Dan commentedI upgraded to 7.x-1.7 and now the title I set for a search page cannot be overridden in the menu, or on the search configuration page, because it's always fixed to "search results".
The attached patch fixes the issue for me, by always reading the page title as set. What's peculiar about this is that when I create a menu entry using the standard menu config it still gets re-written, which I can't imagine anyone would ever want to happen?
Comment #46
stefan.r commentedPatch looks good to me
Comment #47
egbertb commentedYep, is working for me too. Thanx.
Comment #48
markabur commentedI've tried 7.x-1.x-dev and the patch in #45, and my search results page title still reads "Site" no matter what I do. I am trying to edit the Title here: admin/config/search/apachesolr/search-pages/core_search/edit
Is there something I'm missing?
Comment #49
paulbeaney commentedPatch #45 works for me.
Comment #50
gaele commentedComment #51
devin carlson commentedThe patch in #45 is working fine in Commons 7.x-3.x.
Comment #52
drcolossos commentedThis (patch from #45) is not working for me in 1.7. When I step through the execution of the code with a debugger, the site title and callbacks return the proper title that I have set via the interface. But something else seems to override the title after the module has set it's title.
It only works for me on "search/site". The title gets set properly there. The moment I'm on "search/site/%", the provided title seems to be ignored.
(ofc I did a cache clear but that changed nothing)
Comment #53
pdenooijer commentedI had this problem as well. In the search for a solution I noticed that the apachesolr_search_page table was empty.
I fixed this by running the following functions: apachesolr_search_update_7002 up to and including apachesolr_search_update_7006. After that the search page always had the proper title.
Comment #54
rwam commented#45 worked for me in 7.x-1.7
Comment #55
sokrplare commentedTried #45 with 7.x-1.7 with no success (same results as reported in #52).
Tried running apachesolr_search module updates 7002-7006 and still no success.
Tried disabling the page_title module in case that caused a conflict and overrode it after the fact, but no success.
Hoping to revisit, but will be a couple weeks as this isn't launch critical for the current site.
Comment #56
Anonymous (not verified) commented#45 worked on my site with 7.x-1.7.
Comment #57
Colin @ PCMarket commentedPatch on #45 DID NOT WORK for me either on 7.x-dev
Im experiencing the same results as #52
Comment #58
Teastwood commentedI guess I've understand the problem, but not knowing how to solve it.
- In apachesolr_search.module > apachesolr_search_menu_alter(), the 'type' of each apachesolr search page depends on the $core_search var: if there are other search modules activated (Node or User), and if the 'search_path' of the current search page begins with 'search/'.
So each of us could have different behaviors (e.g. if we have other search modules activated or not, if we use the default 'search/site' page or a custom ‘files-search' page).
- If $core_search === TRUE, we'll get the following menu item types:
The 'search/site' path will inherit its title from its parent path: 'search', wether keywords have been sent (router path 'search/site/%') or not (router path 'search/site’).
=> The custom title of the apachesolr search page will always be ignored.
- If $core_search !== TRUE, we'll get the following menu item types:
The 'search/site' path will use the title of the custom search page.
For the 'search/site/%' path, it's tricky: it should use the custom title of the apachesolr search page, too, but if we change the title of this page (e.g. replace the default 'Site' by 'My search'), as the menu item is a MENU_CALLBACK, it won't be rebuild by menu.inc > _menu_navigation_links_rebuild() because it won't be '_visible’ (defined in menu.inc > _menu_router_build()). If you look in the database, table 'menu_links', compare records where link_path is 'search/site' and 'search/site/%': the link_title hasn't been updated for 'search/site/%', it is still 'Site'.
=> The custom title of the apachesolr search page may be ignored.
- I'm not quite sure of what should be done to resolve every case.
Whatever is the value of $core_search, these types give me the behavior that seems good to me:
With MENU_SUGGESTED_ITEM, the 'search/site' path will always use our custom title (but in breadcrumb, we'll have an extra 'Search' item in the active_trail: Search > My search; I guess it may be a problem for some of us in some cases).
And with MENU_DEFAULT_LOCAL_TASK, the 'search/site/%' path will use the custom title too, and won't generate an extra ‘My search' item in the active_trail (we won’t have Search > My search > My search).
But as I said, I'm not sure it's the right way, or if it will brings other problems for other use case...
Any help, suggestions, etc. will be appreciated :)
Comment #59
sokrplare commentedNice work @Leela tracking this all back!!!
TL;DR - based on what Leela posted, I manually changed the
link_titlefor thesearch/site/%in themenu_linkstable and did a flush of the menu cache to start getting the right page title. No patch used.My hunch, is that the patch that was committed in this issue from #40 introduced this issue accidentally with addition of the
$no_tabswhich switched people who had previously been having$core_searchset toTRUEand now have it beingFALSEwhich changes the menu item types as Leela outlined.Comment #60
patrickfgoddard commentedThanks to @Leela and @covenantd for their notes. Help me squash this as well.
Comment #61
MickL commentedStill we have this 4 year old problem in latest dev. Custom search pages are showing "Search result" in the
<title>and<h1>:(Im not really sure how to fix this. #58 and #59 didnt helped me out yet.
WORKAROUND: I ended up using the "Title Override" module. It is working fine, but clear the cache!
EDIT: I created more search pages and the "Title Override" module is not working. Even the menu-links are saying "Search results"
Comment #62
jordanclague commentedPatch from #45 worked for me after upgrading to 7.x-1.8.
Comment #63
matthieu_collet commentedlike @jordanclague, patch #45 with 7.x-1.8 fixed the problem
and for me, I had the problem for some Apache Solr pages, but not all of them, really strange. now they are all ok
thank you @Angry Dan
Comment #64
MickL commentedI can confirm that #45 is working fine for
search-urlandsearch-url/search-termComment #65
johne commented#45 partially works for me. The title gets set on the custom search page with no search terms. but on a page of results $search-result['page_title'] is still correct but title gets overridden to 'Search Materials. My custom search page is at /search/materials. For now I'm using drupal_set_title in hook_apachesolr_search_page_alter
Comment #66
deja711 commentedthank you @Angry Dan, confirmed patch works for me as well.
Comment #67
pwolanin commentedIt would be helpful to have a test case written for this, since there seems to be disagreement as to whether the patch works or not
Comment #68
MickL commentedI confirmed the patch for custom pages. But for the global search it shows "Site" as title.
Comment #69
alrueden commentedAs of version 7.x-1.9, the patch at #45 doesn't work on either the core search page or custom ones.
Comment #70
alrueden commentedComment #71
bburgI'm trying to upgrade from 1.8 to 1.9, one of my search pages, which shows up in the main menu, is normally named "Activities" but after the upgrade, it shows up as "Search results."
I'm just taking a look at this issue now, but it seems that the title callback apachesolr_search_get_value_title(), doesn't attempt to set the title if there are no search terms (which is normal when generating the title in a menu).
Patch in #45 seems to work for me here.