In beta7, when you set the 'Title' in a search page configuration, that was set as the page title when you visited a search page.

In beta9 and latest -dev, that setting appears to be ignored. On normal search pages, the page title is set to 'Search Results'. One the new Core Search search page, the title is set to 'Search'.

Comments

nick_vh’s picture

StatusFileSize
new3.8 KB

Could you see if this fixes it for you?

brianV’s picture

Works on the custom search pages after a cache refresh, but doesn't appear to be working on the core_search page.

nick_vh’s picture

StatusFileSize
new3.78 KB

This 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.

brianV’s picture

Thanks - this does indeed fix the notices.

nick_vh’s picture

Priority: Normal » Critical
nick_vh’s picture

Status: Active » Reviewed & tested by the community
pwolanin’s picture

Status: Reviewed & tested by the community » Fixed

committed

brianV’s picture

Noticing the change to 'fixed' - is the core search page fixed as well?

nick_vh’s picture

The 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?

Status: Fixed » Closed (fixed)

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

brunogoossens’s picture

StatusFileSize
new496 bytes

The patch didn't work for me, so I added an extra line.

nick_vh’s picture

I'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!

jordanmagnuson’s picture

The 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.)

function custom_helper_menu_alter(&$items) {
  $items['search/site']['title'] = 'Test Title';
}

mindbat’s picture

With 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?

mindbat’s picture

StatusFileSize
new655 bytes

Found a fix that worked for the latest version.

I've attached it as a patch.

mindbat’s picture

Status: Closed (fixed) » Needs review
subhojit777’s picture

Status: Needs review » Needs work

This 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

pwolanin’s picture

Perhaps you should be using a title callback. drupal_set_title() is generally not the optimal way to do this.

subhojit777’s picture

I fixed this by replacing %value with search keys. I will see if I create a patch and upload here.

nick_vh’s picture

Priority: Critical » Normal
pwolanin’s picture

In fact, this should already be handled via title callback, so this is the wrong approach

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new1001 bytes

ok, 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?

pwolanin’s picture

Title: Search pages completely ignore the title set in the configuration » Search pages custom pages don't use %value in title
StatusFileSize
new4.7 KB

Here's a fix to use a title callback for custom pages so %value can be used.

pwolanin’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)

committed to 7.x

luco’s picture

hi, has this solution been implemented yet? I got 7.x-1.3, from 2013-Jun-11, and this bug still exists.

cheers

niccolox’s picture

I 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

niccolox’s picture

Status: Patch (to be ported) » Needs review

#23: 1314664-23.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1314664-23.patch, failed testing.

rooby’s picture

I'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.

swarad07’s picture

Version: 6.x-3.x-dev » 7.x-1.6
Priority: Normal » Major
Issue summary: View changes

I 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!

Daemon_Byte’s picture

I can confirm the issue still exists in 1.6. Will try and see if I can find some time to look into it.

Daemon_Byte’s picture

Ok 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.

rooby’s picture

Title: Search pages custom pages don't use %value in title » Search pages custom pages title setting does nothing

Changing title as per mine and other peoples findings.

andy_w’s picture

I 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.

rv0’s picture

the 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.

Daemon_Byte’s picture

rv0 have a look in the db like I suggested in #32. That worked for me. Maybe it will for you?

stefan.r’s picture

StatusFileSize
new6.17 KB

This 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 %terms parameter 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 %value does. This as in @pwolanin's patch %value just displays the value of % in the path (ie. the term name/user name), not the search term.

stefan.r’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 37: apachesolr-title-1314664-36.patch, failed testing.

stefan.r’s picture

Status: Needs work » Needs review
StatusFileSize
new6.43 KB
nick_vh’s picture

Status: Needs review » Patch (to be ported)

Looking good! Committed to 7.x-1.x and needs backport to 6.x-3.x

nick_vh’s picture

Version: 7.x-1.6 » 6.x-3.x-dev
cristiroma’s picture

Not 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)

Status: Patch (to be ported) » Needs review
Angry Dan’s picture

Version: 6.x-3.x-dev » 7.x-1.7
StatusFileSize
new1010 bytes

I 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?

stefan.r’s picture

Patch looks good to me

egbertb’s picture

Yep, is working for me too. Thanx.

markabur’s picture

Version: 7.x-1.7 » 7.x-1.x-dev
Status: Needs review » Needs work

I'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?

paulbeaney’s picture

Patch #45 works for me.

gaele’s picture

devin carlson’s picture

Status: Needs work » Reviewed & tested by the community

The patch in #45 is working fine in Commons 7.x-3.x.

drcolossos’s picture

Status: Reviewed & tested by the community » Needs work

This (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)

pdenooijer’s picture

I 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.

rwam’s picture

#45 worked for me in 7.x-1.7

sokrplare’s picture

Tried #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.

Anonymous’s picture

#45 worked on my site with 7.x-1.7.

Colin @ PCMarket’s picture

Patch on #45 DID NOT WORK for me either on 7.x-dev

Im experiencing the same results as #52

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.

Teastwood’s picture

I 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/'.

$parts = explode('/', $search_page['search_path']);
$active_module_info = search_get_info();
$no_tabs = (sizeof($active_module_info) == 1 && isset($active_module_info['apachesolr_search']));
$core_search = ($parts[0] == 'search' && !$no_tabs);

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:

$items['search/site']['type'] = MENU_LOCAL_TASK;
$items['search/site/%']['type'] = MENU_LOCAL_TASK;

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:

$items['search/site']['type'] = MENU_SUGGESTED_ITEM;
$items['search/site/%']['type'] = MENU_CALLBACK;

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:

$items['search/site']['type'] = MENU_SUGGESTED_ITEM;
$items['search/site/%']['type'] = MENU_DEFAULT_LOCAL_TASK;

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 :)

sokrplare’s picture

Nice work @Leela tracking this all back!!!

TL;DR - based on what Leela posted, I manually changed the link_title for the search/site/% in the menu_links table 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_tabs which switched people who had previously been having $core_search set to TRUE and now have it being FALSE which changes the menu item types as Leela outlined.

patrickfgoddard’s picture

Thanks to @Leela and @covenantd for their notes. Help me squash this as well.

MickL’s picture

Still 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"

jordanclague’s picture

Patch from #45 worked for me after upgrading to 7.x-1.8.

matthieu_collet’s picture

like @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

MickL’s picture

I can confirm that #45 is working fine for search-url and search-url/search-term

johne’s picture

#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

deja711’s picture

thank you @Angry Dan, confirmed patch works for me as well.

pwolanin’s picture

It 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

MickL’s picture

I confirmed the patch for custom pages. But for the global search it shows "Site" as title.

alrueden’s picture

As of version 7.x-1.9, the patch at #45 doesn't work on either the core search page or custom ones.

bburg’s picture

I'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.