Package ome.util.search
Class LuceneQueryBuilder
- java.lang.Object
-
- ome.util.search.LuceneQueryBuilder
-
public class LuceneQueryBuilder extends java.lang.Object
Utility class for building lucene queries
Example:
Fields to search for: 'name', 'description'
Input query: a b AND c AND d f
will be transformed to this lucene expression:
name:a description:a name:f description:f ((name:b description:b) AND (name:c description:c) AND (name:d description:d))
- Since:
- 5.0 TODO: For versions greater than 5.0 this class can be moved from commons to the server
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DATE_ACQUISITION
static java.lang.String
DATE_IMPORT
-
Constructor Summary
Constructors Constructor Description LuceneQueryBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
buildLuceneQuery(java.util.List<java.lang.String> fields, java.lang.String input)
Builds a query with the provided input terms over the given fieldsstatic java.lang.String
buildLuceneQuery(java.util.List<java.lang.String> fields, java.util.Date from, java.util.Date to, java.lang.String dateType, java.lang.String input)
Builds a query with the provided input terms over the given fields
-
-
-
Field Detail
-
DATE_IMPORT
public static final java.lang.String DATE_IMPORT
- See Also:
- Constant Field Values
-
DATE_ACQUISITION
public static final java.lang.String DATE_ACQUISITION
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildLuceneQuery
public static java.lang.String buildLuceneQuery(java.util.List<java.lang.String> fields, java.util.Date from, java.util.Date to, java.lang.String dateType, java.lang.String input) throws InvalidQueryException
Builds a query with the provided input terms over the given fields- Parameters:
fields
-input
-- Returns:
- the query
- Throws:
InvalidQueryException
-
buildLuceneQuery
public static java.lang.String buildLuceneQuery(java.util.List<java.lang.String> fields, java.lang.String input) throws InvalidQueryException
Builds a query with the provided input terms over the given fields- Parameters:
fields
-input
-- Returns:
- the query
- Throws:
InvalidQueryException
-
-