Bug 40248 - With IndependentBranches and SearchMyLibraryFirst logged in user is unable to search other libraries' resources
Summary: With IndependentBranches and SearchMyLibraryFirst logged in user is unable to...
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Janusz Kaczmarek
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-26 11:47 UTC by Janusz Kaczmarek
Modified: 2025-08-10 23:34 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 40248: With IndependentBranches and SearchMyLibraryFirst logged in user is unable to search other libraries' resources (2.45 KB, patch)
2025-06-26 12:08 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 40248: With IndependentBranches and SearchMyLibraryFirst logged in user is unable to search other libraries' resources (2.50 KB, patch)
2025-06-26 20:46 UTC, Roman Dolny
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz Kaczmarek 2025-06-26 11:47:09 UTC
Recently (between 23.11 and 24.11) the following problem has emerged: 
with IndependentBranches = 'Yes' and SearchMyLibraryFirst = 'Limit' 
a logged in user is unable to search other libraries' resources, 
even if OpacAddMastheadLibraryPulldown is set to 'Add'.

To reproduce:
1. Set system preferences: 
   SearchMyLibraryFirst to Limit
   IndependentBranches to Yes
   OpacAddMastheadLibraryPulldown to Add
2. Open OPAC page. You should see the libraries pull down on 
   the right (next to the magnifying glass icon).
3. Perform a search for a common word (e.g. Peter), 
   note the number of results.
4. Log in to OPAC as a normal user (not superlibrarian).
5. Repeat the search. You should get less results (only from your
   library). You will not be able to broaden the search 
   and get results from all libraries (until you log out).
   You will also not see the libraries pull down.
Comment 1 Janusz Kaczmarek 2025-06-26 12:08:16 UTC
Created attachment 183530 [details] [review]
Bug 40248: With IndependentBranches and SearchMyLibraryFirst logged in user is unable to search other libraries' resources

Recently (between 23.11 and 24.11) the following problem has emerged:
with IndependentBranches = 'Yes' and SearchMyLibraryFirst = 'Limit'
a logged in user is unable to search other libraries' resources,
even if OpacAddMastheadLibraryPulldown is set to 'Add'.

Test plan:
1. Set system preferences:
   SearchMyLibraryFirst to Limit
   IndependentBranches to Yes
   OpacAddMastheadLibraryPulldown to Add
2. Open OPAC page. You should see the libraries pull down on
   the right (next to the magnifying glass icon).
3. Perform a search for a common word (e.g. Peter),
   note the number of results.
4. Log in to OPAC as a normal user (not superlibrarian).
5. Repeat the search. You should get less results (only from your
   library). You will not be able to broaden the search
   and get results from all libraries (until you log out).
   You will also not see the libraries pull down.
6. Apply the patch ; restart_all.
7. Repeat p. 2-5. Now you should be able to see the libraries pull
   down, select All libraries and broaden the search for all libraries'
   resources.
Comment 2 Roman Dolny 2025-06-26 20:46:43 UTC
Created attachment 183559 [details] [review]
Bug 40248: With IndependentBranches and SearchMyLibraryFirst logged in user is unable to search other libraries' resources

Recently (between 23.11 and 24.11) the following problem has emerged:
with IndependentBranches = 'Yes' and SearchMyLibraryFirst = 'Limit'
a logged in user is unable to search other libraries' resources,
even if OpacAddMastheadLibraryPulldown is set to 'Add'.

Test plan:
1. Set system preferences:
   SearchMyLibraryFirst to Limit
   IndependentBranches to Yes
   OpacAddMastheadLibraryPulldown to Add
2. Open OPAC page. You should see the libraries pull down on
   the right (next to the magnifying glass icon).
3. Perform a search for a common word (e.g. Peter),
   note the number of results.
4. Log in to OPAC as a normal user (not superlibrarian).
5. Repeat the search. You should get less results (only from your
   library). You will not be able to broaden the search
   and get results from all libraries (until you log out).
   You will also not see the libraries pull down.
6. Apply the patch ; restart_all.
7. Repeat p. 2-5. Now you should be able to see the libraries pull
   down, select All libraries and broaden the search for all libraries'
   resources.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 3 Marcel de Rooy 2025-08-07 14:01:29 UTC
(In reply to Janusz Kaczmarek from comment #0)
> Recently (between 23.11 and 24.11) the following problem has emerged: 
> with IndependentBranches = 'Yes' and SearchMyLibraryFirst = 'Limit' 
> a logged in user is unable to search other libraries' resources, 
> even if OpacAddMastheadLibraryPulldown is set to 'Add'.

Hi Janusz,
This is indeed confusing.
I think we need a solution that brings those two prefs together somewhow. The name SearchMyLibraryFirst is a bit weird too, since the name refers to sorting instead of limiting.
Can we get rid of OpacAddMastheadLibraryPulldown ?
Comment 4 Janusz Kaczmarek 2025-08-07 18:48:53 UTC
(In reply to Marcel de Rooy from comment #3)
> (In reply to Janusz Kaczmarek from comment #0)
> > Recently (between 23.11 and 24.11) the following problem has emerged: 
> > with IndependentBranches = 'Yes' and SearchMyLibraryFirst = 'Limit' 
> > a logged in user is unable to search other libraries' resources, 
> > even if OpacAddMastheadLibraryPulldown is set to 'Add'.
> 
> Hi Janusz,
> This is indeed confusing.
> I think we need a solution that brings those two prefs together somewhow.
> The name SearchMyLibraryFirst is a bit weird too, since the name refers to
> sorting instead of limiting.
> Can we get rid of OpacAddMastheadLibraryPulldown ?

I'm not sure. I can imagine situations where librarians would wish to have the pull-down and also an opposite one.

I agree that the name SearchMyLibraryFirst is a bit misleading but we have it like this from ages. Somehow it is correct and logical: search my library *first*, because it is selected as default, and if you did not find choose all libraries and now search everywhere. This is how it used to work and how what users are used to. 

The described problem arose in an environment of an union catalogue where with settings as described. After an upgrade the users complained that they are unable to search for other libraries resources when logged in. After logging off the are. This is not only inconvenient, it seems to not be logical.

The problem seems to be caused by Bug 36742 where the author and the testers apparently missed this use case and over-limitted the display of 'All libraries' option. So I would regard my patch as a follow-up to 36742.
Comment 5 Marcel de Rooy 2025-08-08 08:04:18 UTC
Yeah, this is still confusing no matter what.. Still looking a bit further.
Comment 6 Marcel de Rooy 2025-08-08 08:52:55 UTC
There are various issues with IndependentBranches. The feature is not very reliable at least. (Also note that there is only a small minority using it.)
But I do agree that we should be able to search for biblio records since they are not attached to branches.

Instead of adding a condition referring to the pref, I would be tempted to ask why not remove the other condition and only check OpacAddMastheadLibraryPulldown in masthead?
Or even should we pass unfiltered to Branches.all? search_filtered goes to only_my_library which triggers the confusing difference of showing public branches to anonymous users and hiding them for normal users (when IB is enabled).

When testing with a biblio having an item on a private branch, I am also wondering why do we not list that branch in the combo but show its name in search results and on opac-detail. Also adding a link to the branch in the item table that produces a 404 when clicking it. Out of scope here but confusing.

The fact that the library combo jumps back to my library after searching on All libraries is not very helpful too imo.

Not sure what would be best. We probably need more consensus. Will ask for more opinions on MM.
Comment 7 David Cook 2025-08-10 23:34:03 UTC
Sorry can someone explain the desired behaviour vs the existing behaviour?