Search::QueryBuilder - Perl extension for tokenising search strings and building queries
use Search::QueryBuilder; my $querybuild=new QueryBuilder; # $querystring contains a query along the lines of "A key phrase" -"keyword" AND keyword +keyword my @responsearr=$querybuild->getTokenizedString($querystring); # @responsearr contains the keywords and phrases, plus booleans where provided If you intend to use more than the basic booleans, add them as follows: my @mytaglist=("AND","OR","NOT","XOR"); $querybuild->tags(@mytaglist);
QueryBuilder is a very simple tokeniser, designed to decode a query string into something you can create a database query from (into SQL, Cheshire, that sort of thing).
It tries to do a little sanity checking, but is still in active development so expect changes. The creation of queries from the resulting string is partly merged into the module, but expect this interface to change.
None by default.
This one is designed specifically for use as part of a search system, and is likely to evolve in that direction (handling of prefixes, building up search queries in various formats and so forth).
E Tonkin, <email@example.com<gt>
Copyright (C) 2006 by E Tonkin
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.