Class FullTextQueryHelper
- java.lang.Object
-
- org.cyclos.impl.sql.postgresql.fulltext.FullTextQueryHelper
-
public class FullTextQueryHelper extends Object
Contains helper methods to handle full text query strings
-
-
Constructor Summary
Constructors Constructor Description FullTextQueryHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FullTextQueryparse(String queryString, boolean phraseSupported)Parses the given query string.static FullTextQueryparsePlain(String queryString)Parses the given query string in a plain way, that means: The query string is split in white spaces.
-
-
-
Method Detail
-
parse
public static FullTextQuery parse(String queryString, boolean phraseSupported) throws QueryParseException
Parses the given query string. The accepted format is:- term1 term2: Matches either term1 or term2
- term1 +term2: Matches both term1 and term2
- term1 -term2: Matches term1 and not term2
- "term1 term2": Matches term1 term2 in the exact sequence (only if phraseSupported is true, otherwise is the same as term1 +term2)
- term*: Matches any term which starts with the given prefix
- Also, parenthesis can be used, like: (term1 term2) -"term3 term4"
- Throws:
QueryParseException
-
parsePlain
public static FullTextQuery parsePlain(String queryString) throws QueryParseException
Parses the given query string in a plain way, that means:- The query string is split in white spaces. Any of these characters are ignored: *()
- For each part:
- If it contains punctuation, it is matched in the exact sequence, as if that part were quoted, for example, user@mail.com matches "user@mail.com".
- Otherwise, the part is matched as prefix, for example, user matches user*. Leading asterisks are ignored.
- Throws:
QueryParseException
-
-