Fix for 1863: Result list for 'scan' index searches incorrect after first page

This commit is contained in:
Joshua Ferraro 2008-07-14 11:33:13 -05:00
parent 6ff2026281
commit 9f3e6b4a40
2 changed files with 23 additions and 16 deletions

View File

@ -357,6 +357,11 @@ my @operators;
my @indexes;
@indexes = split("\0",$params->{'idx'});
# if a simple index (only one) display the index used in the top search box
if ($indexes[0] && !$indexes[1]) {
$template->param("ms_".$indexes[0] => 1);}
# an operand can be a single term, a phrase, or a complete ccl query
my @operands;
@operands = split("\0",$params->{'q'}) if $params->{'q'};
@ -414,7 +419,7 @@ my @results;
## parse the query_cgi string and put it into a form suitable for <input>s
my @query_inputs;
my $scan_index;
my $scan_index_to_use;
for my $this_cgi ( split('&',$query_cgi) ) {
next unless $this_cgi;
@ -423,10 +428,12 @@ for my $this_cgi ( split('&',$query_cgi) ) {
my $input_value = $2;
$input_name =~ s/=$//;
push @query_inputs, { input_name => $input_name, input_value => $input_value };
$scan_index = $input_value unless $scan_index;
if ($input_name eq 'idx') {
$scan_index_to_use = $input_value; # unless $scan_index_to_use;
}
}
$template->param ( QUERY_INPUTS => \@query_inputs,
scan_index => $scan_index );
scan_index_to_use => $scan_index_to_use );
## parse the limit_cgi string and put it into a form suitable for <input>s
my @limit_inputs;

View File

@ -119,18 +119,18 @@ $(window).load(function() {
<label for="scan-index">Indexed in:</label>
<select name="idx" id="scan-index">
<option value="">Any Word</option>
<option value="any,phr:">Any Phrase</option>
<option value="ti:">Title</option>
<option value="ti,phr:">Title Phrase</option>
<option value="au,phr:">Author</option>
<option value="su:">Subject</option>
<option value="su,phr:">Subject Phrase</option>
<option value="se:">Series</option>
<option value="pb:">Publisher</option>
<option value="nt:">Notes</option>
<option value="se:">Series Title</option>
<option value="sn:">ISBN</option>
<option value="ss:">ISSN</option>
<option <!-- TMPL_IF NAME="ms_any,phr" --> selected="selected" <!-- /TMPL_IF --> value="any,phr">Any Phrase</option>
<option <!-- TMPL_IF NAME="ms_ti" --> selected="selected" <!-- /TMPL_IF --> value="ti">Title</option>
<option <!-- TMPL_IF NAME="ms_ti,phr" --> selected="selected" <!-- /TMPL_IF --> value="ti,phr">Title Phrase</option>
<option <!-- TMPL_IF NAME="ms_au,phr" --> selected="selected" <!-- /TMPL_IF --> value="au,phr">Author</option>
<option <!-- TMPL_IF NAME="ms_su" --> selected="selected" <!-- /TMPL_IF --> value="su">Subject</option>
<option <!-- TMPL_IF NAME="ms_su,phr" --> selected="selected" <!-- /TMPL_IF --> value="su,phr">Subject Phrase</option>
<option <!-- TMPL_IF NAME="ms_se" --> selected="selected" <!-- /TMPL_IF --> value="se">Series</option>
<option <!-- TMPL_IF NAME="ms_pb" --> selected="selected" <!-- /TMPL_IF --> value="pb">Publisher</option>
<option <!-- TMPL_IF NAME="ms_nt" --> selected="selected" <!-- /TMPL_IF --> value="nt">Notes</option>
<option <!-- TMPL_IF NAME="ms_se" --> selected="selected" <!-- /TMPL_IF --> value="se">Series Title</option>
<option <!-- TMPL_IF NAME="ms_sn" --> selected="selected" <!-- /TMPL_IF --> value="sn">ISBN</option>
<option <!-- TMPL_IF NAME="ms_ss" --> selected="selected" <!-- /TMPL_IF --> value="ss">ISSN</option>
</select>
<input type="hidden" name="scan" value="1" />
</td>
@ -147,7 +147,7 @@ $(window).load(function() {
<!-- TMPL_LOOP NAME="SEARCH_RESULTS" -->
<!-- TMPL_IF NAME="__odd__" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
<td>
<a href="/cgi-bin/koha/catalogue/search.pl?idx=<!-- TMPL_VAR name="scan_index" -->&amp;q=<!-- TMPL_VAR NAME="scan_use" escape="url" -->&quot;<!-- TMPL_VAR NAME="title_nospan" -->&quot;"><!-- TMPL_VAR NAME="title" --></a>
<a href="/cgi-bin/koha/catalogue/search.pl?idx=<!-- TMPL_VAR name="scan_index_to_use" -->&amp;q=<!-- TMPL_VAR NAME="scan_use" escape="url" -->&quot;<!-- TMPL_VAR NAME="title_nospan" -->&quot;"><!-- TMPL_VAR NAME="title" --></a>
</td>
<td>
<!-- TMPL_VAR NAME="author" -->