Changeset 2536


Ignore:
Timestamp:
02/23/10 08:12:05 (2 years ago)
Author:
karpet
Message:

bump version; clarify comments

Location:
Search-Query/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • Search-Query/trunk/Changes

    r2510 r2536  
    3535          their respective default regex. 
    3636 
     370.08    xxx 
     38        * clarify NOT regex comments to include ! 
  • Search-Query/trunk/lib/Search/Query.pm

    r2510 r2536  
    1212    sub_name    => 'dialects'; 
    1313 
    14 our $VERSION = '0.07'; 
     14our $VERSION = '0.08'; 
    1515 
    1616=head1 NAME 
  • Search-Query/trunk/lib/Search/Query/Clause.pm

    r2502 r2536  
    66use Scalar::Util qw( blessed ); 
    77 
    8 our $VERSION = '0.07'; 
     8our $VERSION = '0.08'; 
    99 
    1010__PACKAGE__->mk_accessors(qw( field op value quote )); 
  • Search-Query/trunk/lib/Search/Query/Dialect.pm

    r2508 r2536  
    1616__PACKAGE__->mk_accessors( qw( default_field parser ) ); 
    1717 
    18 our $VERSION = '0.07'; 
     18our $VERSION = '0.08'; 
    1919 
    2020=head1 NAME 
  • Search-Query/trunk/lib/Search/Query/Dialect/Native.pm

    r2502 r2536  
    66use Data::Dump qw( dump ); 
    77 
    8 our $VERSION = '0.07'; 
     8our $VERSION = '0.08'; 
    99 
    1010=head1 NAME 
  • Search-Query/trunk/lib/Search/Query/Dialect/SQL.pm

    r2508 r2536  
    1919); 
    2020 
    21 our $VERSION = '0.07'; 
     21our $VERSION = '0.08'; 
    2222 
    2323=head1 NAME 
  • Search-Query/trunk/lib/Search/Query/Dialect/SWISH.pm

    r2508 r2536  
    77use Search::Query::Field::SWISH; 
    88 
    9 our $VERSION = '0.07'; 
     9our $VERSION = '0.08'; 
    1010 
    1111__PACKAGE__->mk_accessors( 
  • Search-Query/trunk/lib/Search/Query/Field.pm

    r2482 r2536  
    55use base qw( Rose::ObjectX::CAF ); 
    66 
    7 our $VERSION = '0.07'; 
     7our $VERSION = '0.08'; 
    88 
    99__PACKAGE__->mk_accessors(qw( name alias_for callback )); 
  • Search-Query/trunk/lib/Search/Query/Field/SQL.pm

    r2482 r2536  
    77    qw( type fuzzy_op fuzzy_not_op is_int )); 
    88 
    9 our $VERSION = '0.07'; 
     9our $VERSION = '0.08'; 
    1010 
    1111=head1 NAME 
  • Search-Query/trunk/lib/Search/Query/Field/SWISH.pm

    r2508 r2536  
    66__PACKAGE__->mk_accessors(qw( type is_int )); 
    77 
    8 our $VERSION = '0.07'; 
     8our $VERSION = '0.08'; 
    99 
    1010=head1 NAME 
  • Search-Query/trunk/lib/Search/Query/Parser.pm

    r2510 r2536  
    1111use Scalar::Util qw( blessed weaken ); 
    1212 
    13 our $VERSION = '0.07'; 
     13our $VERSION = '0.08'; 
    1414 
    1515__PACKAGE__->mk_accessors( 
     
    114114that supports multiple query dialects. 
    115115 
    116 The Parser class transforms a query string into a Dialect object structure  
     116The Parser class transforms a query string into a Dialect object structure 
    117117to be handled by external search engines. 
    118118 
     
    132132=head1 QUERY STRING 
    133133 
    134 The query string is decomposed into Clause objects, where  
    135 each Clause has an optional sign prefix,  
    136 an optional field name and comparison operator,  
     134The query string is decomposed into Clause objects, where 
     135each Clause has an optional sign prefix, 
     136an optional field name and comparison operator, 
    137137and a mandatory value. 
    138138 
     
    149149=head2 Field name and comparison operator 
    150150 
    151 Internally, each query item has a field name and comparison  
     151Internally, each query item has a field name and comparison 
    152152operator; if not written explicitly in the query, these 
    153 take default values C<''> (empty field name) and  
     153take default values C<''> (empty field name) and 
    154154C<':'> (colon operator). 
    155155 
    156 Operators have a left operand (the field name) and  
     156Operators have a left operand (the field name) and 
    157157a right operand (the value to be compared with); 
    158 for example, C<foo:bar> means "search documents containing  
    159 term 'bar' in field 'foo'", whereas C<foo=bar> means  
     158for example, C<foo:bar> means "search documents containing 
     159term 'bar' in field 'foo'", whereas C<foo=bar> means 
    160160"search documents where field 'foo' has exact value 'bar'". 
    161161 
     
    166166=item C<:> 
    167167 
    168 treat value as a term to be searched within field.  
     168treat value as a term to be searched within field. 
    169169This is the default operator. 
    170170 
     
    184184 
    185185Inclusion in the set of comma-separated integers supplied 
    186 on the right-hand side.  
     186on the right-hand side. 
    187187 
    188188=back 
    189189 
    190 Operators C<:>, C<~>, C<=~>, C<!~> and C<#> admit an empty  
     190Operators C<:>, C<~>, C<=~>, C<!~> and C<#> admit an empty 
    191191left operand (so the field name will be C<''>). 
    192 Search engines will usually interpret this as  
     192Search engines will usually interpret this as 
    193193"any field" or "the whole data record". But see the B<default_field> 
    194194feature. 
     
    196196=head2 Value 
    197197 
    198 A value (right operand to a comparison operator) can be  
     198A value (right operand to a comparison operator) can be 
    199199 
    200200=over 
     
    211211Quotes can be used not only for "exact phrases", but also 
    212212to prevent misinterpretation of some values : for example 
    213 C<-2> would mean "value '2' with prefix '-'",  
     213C<-2> would mean "value '2' with prefix '-'", 
    214214in other words "exclude term '2'", so if you want to search for 
    215215value -2, you should write C<"-2"> instead. 
     
    218218 
    219219A subquery within parentheses. 
    220 Field names and operators distribute over parentheses, so for  
    221 example C<foo:(bar bie)> is equivalent to  
     220Field names and operators distribute over parentheses, so for 
     221example C<foo:(bar bie)> is equivalent to 
    222222C<foo:bar foo:bie>. 
    223223 
     
    238238C<a OR b> is equivalent to C<(a b)>; 
    239239C<NOT a> is equivalent to C<-a>. 
    240 C<+a OR b> does not make sense,  
     240C<+a OR b> does not make sense, 
    241241but it is translated into C<(a b)>, under the assumption 
    242 that the user understands "OR" better than a  
     242that the user understands "OR" better than a 
    243243'+' prefix. 
    244 C<-a OR b> does not make sense either,  
     244C<-a OR b> does not make sense either, 
    245245but has no meaningful approximation, so it is rejected. 
    246246 
     
    381381    field4 => { alias_for => [qw( field1 field3 )] }, 
    382382 }; 
    383   
     383 
    384384 # or 
    385   
     385 
    386386 my $fields = [ 
    387387    'field1', 
     
    648648            } 
    649649 
    650             # try to parse sign prefix ('+', '-' or 'NOT') 
     650            # try to parse sign prefix ('+', '-' or '!|NOT') 
    651651            if    (s/^(\+|-)\s*//)         { $sign = $1; } 
    652652            elsif (s/^($not_regex)\b\s*//) { $sign = '-'; } 
    653             elsif (s/^\!\s*([^:=~])/$1/)   { $sign = '-'; } 
     653 
     654            # special check because of \b above 
     655            elsif (s/^\!\s*([^:=~])/$1/) { $sign = '-'; } 
    654656 
    655657            # try to parse field name and operator 
Note: See TracChangeset for help on using the changeset viewer.