Bug 7607 - Advanced search: Index and search term don't match when leaving fields empty
Summary: Advanced search: Index and search term don't match when leaving fields empty
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Target Milestone: ---
Assignee: Galen Charlton
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 9234
  Show dependency treegraph
 
Reported: 2012-02-26 17:05 UTC by Katrin Fischer
Modified: 2018-04-11 15:26 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2012-02-26 17:05:44 UTC
On advanced search in OPAC or staff:
 
- leave the first pulldown on keyword and the search term empty
- select author or title from the second pull down and enter a search term

What will happen is, that Koha performs a keyword search with the search term from the second pull down. This means:

Keyword: empty
Title: <search term>
Keyword: empty

is equal to

Keyword: <search term>
Keyword: empty
Keyword: empty

but not the same as:

Title : <search term>
Keyword: empty
Keyword: empty

I wonder if this is related to bug 3264? But not sure how to fix it.
Comment 1 Koha Team Lyon 3 2013-03-15 15:51:06 UTC
Same observation at Lyon3 : the problem comes from what Paul Poulain pointed out in last comment of bug 3264. (But a recent test in Chrome got the same wrong result as in Firefox).
As a work around I put the following function in opacuserjs syspref but I guess it would be better to find a more orthodox way :

$(document).ready(function(){
$("input[name='do']").click(function(){
    $("input[name='q']").each(function(i){
        if (!$(this).val()){
            $("select[name='idx']").eq(i).append('<option value="" selected="selected"></option>'); 
        }
    }); 
});
});

and in intranetuserjs :

$(document).ready(function() {
$("#submit1,#submit2").click(function(){
    $("input[name='q']").each(function(i){
        if (!$(this).val()){
            $("select[name='idx']").eq(i).append('<option value="" selected="selected"></option>'); 
        }
    }); 
});
});

Olivier Crouzet
Comment 2 Katrin Fischer 2013-03-15 17:08:49 UTC
Adding Jared in CC as I think he mentioned his search rewrite work might have a fix for this :)
Comment 3 Fridolin SOMERS 2013-12-31 09:07:16 UTC
This might be caused by URL-rewriting (in apache configuration).
Because when Keyword is selected, the value of select is empty and it generates in URL "&idx=" which is removed by URL-rewriting.