- LICENSE AND COPYRIGHT
- COPYRIGHT AND LICENSE
Search::Elasticsearch::Compat::Util - Provides the filter_keywords utility
use Search::Elasticsearch::Compat::Util qw(filter_keywords); my $filtered = filter_keywords($unfiltered)
This tidies up a string to be used as a query string in (eg) "search()" in Search::Elasticsearch::Compat so that user input won't cause a search query to return an error.
It is not flexible at all, and may or may not be useful to you.
Have a look at Search::Elasticsearch::Compat::QueryParser which gives you much more control over your query strings.
The current implementation does the following:
Removes any character which isn't a letter, a number, a space or
-that doesn't have a space in front of it ( "foo -bar") is acceptable as it means
'foo' but not with 'bar'
Removes any space after a
-which is not followed by a letter, number or a double quote
*that doesn't have at least 3 letters before it, ie we only allow wildcard searches on words with at least 3 characters
Closes any open double quotes
Removes leading and trailing whitespace
Copyright 2009-2013 - 2011 Clinton Gormley.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
Clinton Gormley <firstname.lastname@example.org>
This software is Copyright (c) 2014 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004