Changeset 2536
- Timestamp:
- 02/23/10 08:12:05 (2 years ago)
- Location:
- Search-Query/trunk
- Files:
-
- 11 edited
-
Changes (modified) (1 diff)
-
lib/Search/Query.pm (modified) (1 diff)
-
lib/Search/Query/Clause.pm (modified) (1 diff)
-
lib/Search/Query/Dialect.pm (modified) (1 diff)
-
lib/Search/Query/Dialect/Native.pm (modified) (1 diff)
-
lib/Search/Query/Dialect/SQL.pm (modified) (1 diff)
-
lib/Search/Query/Dialect/SWISH.pm (modified) (1 diff)
-
lib/Search/Query/Field.pm (modified) (1 diff)
-
lib/Search/Query/Field/SQL.pm (modified) (1 diff)
-
lib/Search/Query/Field/SWISH.pm (modified) (1 diff)
-
lib/Search/Query/Parser.pm (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Search-Query/trunk/Changes
r2510 r2536 35 35 their respective default regex. 36 36 37 0.08 xxx 38 * clarify NOT regex comments to include ! -
Search-Query/trunk/lib/Search/Query.pm
r2510 r2536 12 12 sub_name => 'dialects'; 13 13 14 our $VERSION = '0.0 7';14 our $VERSION = '0.08'; 15 15 16 16 =head1 NAME -
Search-Query/trunk/lib/Search/Query/Clause.pm
r2502 r2536 6 6 use Scalar::Util qw( blessed ); 7 7 8 our $VERSION = '0.0 7';8 our $VERSION = '0.08'; 9 9 10 10 __PACKAGE__->mk_accessors(qw( field op value quote )); -
Search-Query/trunk/lib/Search/Query/Dialect.pm
r2508 r2536 16 16 __PACKAGE__->mk_accessors( qw( default_field parser ) ); 17 17 18 our $VERSION = '0.0 7';18 our $VERSION = '0.08'; 19 19 20 20 =head1 NAME -
Search-Query/trunk/lib/Search/Query/Dialect/Native.pm
r2502 r2536 6 6 use Data::Dump qw( dump ); 7 7 8 our $VERSION = '0.0 7';8 our $VERSION = '0.08'; 9 9 10 10 =head1 NAME -
Search-Query/trunk/lib/Search/Query/Dialect/SQL.pm
r2508 r2536 19 19 ); 20 20 21 our $VERSION = '0.0 7';21 our $VERSION = '0.08'; 22 22 23 23 =head1 NAME -
Search-Query/trunk/lib/Search/Query/Dialect/SWISH.pm
r2508 r2536 7 7 use Search::Query::Field::SWISH; 8 8 9 our $VERSION = '0.0 7';9 our $VERSION = '0.08'; 10 10 11 11 __PACKAGE__->mk_accessors( -
Search-Query/trunk/lib/Search/Query/Field.pm
r2482 r2536 5 5 use base qw( Rose::ObjectX::CAF ); 6 6 7 our $VERSION = '0.0 7';7 our $VERSION = '0.08'; 8 8 9 9 __PACKAGE__->mk_accessors(qw( name alias_for callback )); -
Search-Query/trunk/lib/Search/Query/Field/SQL.pm
r2482 r2536 7 7 qw( type fuzzy_op fuzzy_not_op is_int )); 8 8 9 our $VERSION = '0.0 7';9 our $VERSION = '0.08'; 10 10 11 11 =head1 NAME -
Search-Query/trunk/lib/Search/Query/Field/SWISH.pm
r2508 r2536 6 6 __PACKAGE__->mk_accessors(qw( type is_int )); 7 7 8 our $VERSION = '0.0 7';8 our $VERSION = '0.08'; 9 9 10 10 =head1 NAME -
Search-Query/trunk/lib/Search/Query/Parser.pm
r2510 r2536 11 11 use Scalar::Util qw( blessed weaken ); 12 12 13 our $VERSION = '0.0 7';13 our $VERSION = '0.08'; 14 14 15 15 __PACKAGE__->mk_accessors( … … 114 114 that supports multiple query dialects. 115 115 116 The Parser class transforms a query string into a Dialect object structure 116 The Parser class transforms a query string into a Dialect object structure 117 117 to be handled by external search engines. 118 118 … … 132 132 =head1 QUERY STRING 133 133 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, 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, 137 137 and a mandatory value. 138 138 … … 149 149 =head2 Field name and comparison operator 150 150 151 Internally, each query item has a field name and comparison 151 Internally, each query item has a field name and comparison 152 152 operator; if not written explicitly in the query, these 153 take default values C<''> (empty field name) and 153 take default values C<''> (empty field name) and 154 154 C<':'> (colon operator). 155 155 156 Operators have a left operand (the field name) and 156 Operators have a left operand (the field name) and 157 157 a 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 158 for example, C<foo:bar> means "search documents containing 159 term 'bar' in field 'foo'", whereas C<foo=bar> means 160 160 "search documents where field 'foo' has exact value 'bar'". 161 161 … … 166 166 =item C<:> 167 167 168 treat value as a term to be searched within field. 168 treat value as a term to be searched within field. 169 169 This is the default operator. 170 170 … … 184 184 185 185 Inclusion in the set of comma-separated integers supplied 186 on the right-hand side. 186 on the right-hand side. 187 187 188 188 =back 189 189 190 Operators C<:>, C<~>, C<=~>, C<!~> and C<#> admit an empty 190 Operators C<:>, C<~>, C<=~>, C<!~> and C<#> admit an empty 191 191 left operand (so the field name will be C<''>). 192 Search engines will usually interpret this as 192 Search engines will usually interpret this as 193 193 "any field" or "the whole data record". But see the B<default_field> 194 194 feature. … … 196 196 =head2 Value 197 197 198 A value (right operand to a comparison operator) can be 198 A value (right operand to a comparison operator) can be 199 199 200 200 =over … … 211 211 Quotes can be used not only for "exact phrases", but also 212 212 to prevent misinterpretation of some values : for example 213 C<-2> would mean "value '2' with prefix '-'", 213 C<-2> would mean "value '2' with prefix '-'", 214 214 in other words "exclude term '2'", so if you want to search for 215 215 value -2, you should write C<"-2"> instead. … … 218 218 219 219 A subquery within parentheses. 220 Field names and operators distribute over parentheses, so for 221 example C<foo:(bar bie)> is equivalent to 220 Field names and operators distribute over parentheses, so for 221 example C<foo:(bar bie)> is equivalent to 222 222 C<foo:bar foo:bie>. 223 223 … … 238 238 C<a OR b> is equivalent to C<(a b)>; 239 239 C<NOT a> is equivalent to C<-a>. 240 C<+a OR b> does not make sense, 240 C<+a OR b> does not make sense, 241 241 but it is translated into C<(a b)>, under the assumption 242 that the user understands "OR" better than a 242 that the user understands "OR" better than a 243 243 '+' prefix. 244 C<-a OR b> does not make sense either, 244 C<-a OR b> does not make sense either, 245 245 but has no meaningful approximation, so it is rejected. 246 246 … … 381 381 field4 => { alias_for => [qw( field1 field3 )] }, 382 382 }; 383 383 384 384 # or 385 385 386 386 my $fields = [ 387 387 'field1', … … 648 648 } 649 649 650 # try to parse sign prefix ('+', '-' or ' NOT')650 # try to parse sign prefix ('+', '-' or '!|NOT') 651 651 if (s/^(\+|-)\s*//) { $sign = $1; } 652 652 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 = '-'; } 654 656 655 657 # try to parse field name and operator
Note: See TracChangeset
for help on using the changeset viewer.