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

(-)a/C4/Search.pm (-6 / +21 lines)
Lines 1417-1433 sub buildQuery { Link Here
1417
                my $index   = $indexes[$i];
1417
                my $index   = $indexes[$i];
1418
1418
1419
                # Add index-specific attributes
1419
                # Add index-specific attributes
1420
1421
                #Afaik, this 'yr' condition will only ever be met in the staff client advanced search
1422
                #for "Publication date", since typing 'yr:YYYY' into the search box produces a CCL query,
1423
                #which is processed higher up in this sub. Other than that, year searches are typically
1424
                #handled as limits which are not processed her either.
1425
1420
                # Date of Publication
1426
                # Date of Publication
1421
                if ( $index eq 'yr' ) {
1427
                if ( $index =~ /yr/ ) {
1422
                    $index .= ",st-numeric";
1428
                    #weight_fields/relevance search causes errors with date ranges
1423
                    $indexes_set++;
1429
                    #In the case of YYYY-, it will only return records with a 'yr' of YYYY (not the range)
1430
                    #In the case of YYYY-YYYY, it will return no results
1424
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1431
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1425
                }
1432
                }
1426
1433
1427
                # Date of Acquisition
1434
                # Date of Acquisition
1428
                elsif ( $index eq 'acqdate' ) {
1435
                elsif ( $index =~ /acqdate/ ) {
1429
                    $index .= ",st-date-normalized";
1436
                    #stemming and auto_truncation would have zero impact since it already is YYYY-MM-DD format
1430
                    $indexes_set++;
1437
                    #Weight_fields probably SHOULD be turned OFF, otherwise you'll get records floating to the
1438
                      #top of the results just because they have lots of item records matching that date.
1439
                    #Fuzzy actually only applies during _build_weighted_query, and is reset there anyway, so
1440
                      #irrelevant here
1441
                    #remove_stopwords doesn't function anymore so is irrelevant
1431
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1442
					$stemming = $auto_truncation = $weight_fields = $fuzzy_enabled = $remove_stopwords = 0;
1432
                }
1443
                }
1433
                # ISBN,ISSN,Standard Number, don't need special treatment
1444
                # ISBN,ISSN,Standard Number, don't need special treatment
Lines 1614-1622 sub buildQuery { Link Here
1614
    # This is flawed , means we can't search anything with : in it
1625
    # This is flawed , means we can't search anything with : in it
1615
    # if user wants to do ccl or cql, start the query with that
1626
    # if user wants to do ccl or cql, start the query with that
1616
#    $query =~ s/:/=/g;
1627
#    $query =~ s/:/=/g;
1628
    #NOTE: We use several several different regexps here as you can't have variable length lookback assertions
1617
    $query =~ s/(?<=(ti|au|pb|su|an|kw|mc|nb|ns)):/=/g;
1629
    $query =~ s/(?<=(ti|au|pb|su|an|kw|mc|nb|ns)):/=/g;
1618
    $query =~ s/(?<=(wrdl)):/=/g;
1630
    $query =~ s/(?<=(wrdl)):/=/g;
1619
    $query =~ s/(?<=(trn|phr)):/=/g;
1631
    $query =~ s/(?<=(trn|phr)):/=/g;
1632
    $query =~ s/(?<=(st-numeric)):/=/g;
1633
    $query =~ s/(?<=(st-year)):/=/g;
1634
    $query =~ s/(?<=(st-date-normalized)):/=/g;
1620
    $limit =~ s/:/=/g;
1635
    $limit =~ s/:/=/g;
1621
    for ( $query, $query_desc, $limit, $limit_desc ) {
1636
    for ( $query, $query_desc, $limit, $limit_desc ) {
1622
        s/  +/ /g;    # remove extra spaces
1637
        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