View | Details | Raw Unified | Return to bug 9368
Collapse All | Expand All

(-)a/C4/Search.pm (-6 / +21 lines)
Lines 1371-1387 sub buildQuery { Link Here
1371
                my $index   = $indexes[$i];
1371
                my $index   = $indexes[$i];
1372
1372
1373
                # Add index-specific attributes
1373
                # Add index-specific attributes
1374
1375
                #Afaik, this 'yr' condition will only ever be met in the staff client advanced search
1376
                #for "Publication date", since typing 'yr:YYYY' into the search box produces a CCL query,
1377
                #which is processed higher up in this sub. Other than that, year searches are typically
1378
                #handled as limits which are not processed her either.
1379
1374
                # Date of Publication
1380
                # Date of Publication
1375
                if ( $index eq 'yr' ) {
1381
                if ( $index =~ /yr/ ) {
1376
                    $index .= ",st-numeric";
1382
                    #weight_fields/relevance search causes errors with date ranges
1377
                    $indexes_set++;
1383
                    #In the case of YYYY-, it will only return records with a 'yr' of YYYY (not the range)
1384
                    #In the case of YYYY-YYYY, it will return no results
1378
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1385
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1379
                }
1386
                }
1380
1387
1381
                # Date of Acquisition
1388
                # Date of Acquisition
1382
                elsif ( $index eq 'acqdate' ) {
1389
                elsif ( $index =~ /acqdate/ ) {
1383
                    $index .= ",st-date-normalized";
1390
                    #stemming and auto_truncation would have zero impact since it already is YYYY-MM-DD format
1384
                    $indexes_set++;
1391
                    #Weight_fields probably SHOULD be turned OFF, otherwise you'll get records floating to the
1392
                      #top of the results just because they have lots of item records matching that date.
1393
                    #Fuzzy actually only applies during _build_weighted_query, and is reset there anyway, so
1394
                      #irrelevant here
1395
                    #remove_stopwords doesn't function anymore so is irrelevant
1385
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1396
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1386
                }
1397
                }
1387
                # ISBN,ISSN,Standard Number, don't need special treatment
1398
                # ISBN,ISSN,Standard Number, don't need special treatment
Lines 1568-1576 sub buildQuery { Link Here
1568
    # This is flawed , means we can't search anything with : in it
1579
    # This is flawed , means we can't search anything with : in it
1569
    # if user wants to do ccl or cql, start the query with that
1580
    # if user wants to do ccl or cql, start the query with that
1570
#    $query =~ s/:/=/g;
1581
#    $query =~ s/:/=/g;
1582
    #NOTE: We use several several different regexps here as you can't have variable length lookback assertions
1571
    $query =~ s/(?<=(ti|au|pb|su|an|kw|mc|nb|ns)):/=/g;
1583
    $query =~ s/(?<=(ti|au|pb|su|an|kw|mc|nb|ns)):/=/g;
1572
    $query =~ s/(?<=(wrdl)):/=/g;
1584
    $query =~ s/(?<=(wrdl)):/=/g;
1573
    $query =~ s/(?<=(trn|phr)):/=/g;
1585
    $query =~ s/(?<=(trn|phr)):/=/g;
1586
    $query =~ s/(?<=(st-numeric)):/=/g;
1587
    $query =~ s/(?<=(st-year)):/=/g;
1588
    $query =~ s/(?<=(st-date-normalized)):/=/g;
1574
    $limit =~ s/:/=/g;
1589
    $limit =~ s/:/=/g;
1575
    for ( $query, $query_desc, $limit, $limit_desc ) {
1590
    for ( $query, $query_desc, $limit, $limit_desc ) {
1576
        s/  +/ /g;    # remove extra spaces
1591
        s/  +/ /g;    # remove extra spaces
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc (-3 / +11 lines)
Lines 40-45 Link Here
40
    [% END %]
40
    [% END %]
41
    <option value="pb">Publisher</option>
41
    <option value="pb">Publisher</option>
42
    <option value="pl">Publisher location</option>
42
    <option value="pl">Publisher location</option>
43
    <option value="yr">Publication date (yyyy)</option>
43
    [%#
44
    <option value="acqdate">Acquisition date (yyyy-mm-dd)</option>
44
        Use non-normalized st-year instead of st-numeric,
45
        since pubdate can include 'u' to signify unkown
46
        dates. See "Legal Characters" at:
47
        http://www.loc.gov/marc/bibliographic/bd008a.html
48
49
        This search is also for date ranges due to the
50
        special Zebra r=r CCL mapping for 'yr'
51
    %]
52
    <option value="yr,st-year">Publication date (yyyy-yyyy)</option>
53
    <option value="acqdate,st-date-normalized">Acquisition date (yyyy-mm-dd)</option>
45
</select>
54
</select>
46
- 

Return to bug 9368