Package com.nuix.superutilities.query
Class QueryHelper
- java.lang.Object
-
- com.nuix.superutilities.query.QueryHelper
-
public class QueryHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description QueryHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
escapeForSearch(java.lang.String value)
static java.lang.String
joinByAnd(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " AND ", so expressions "cat", "dog" would become "cat AND dog".static java.lang.String
joinByOr(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " OR ", so expressions "cat", "dog" would become "cat OR dog".static java.lang.String
markupSetQuery(nuix.MarkupSet markupSet)
static java.lang.String
namedEntityQuery(java.util.Collection<java.lang.String> entityNames)
Generates a query to find items which have a match for any of the provided named entities.static java.lang.String
notJoinByAnd(java.util.Collection<java.lang.String> expressions)
Returns a query in the form:NOT (a AND b AND c)
with a,b and c being expressions provided.static java.lang.String
notJoinByOr(java.util.Collection<java.lang.String> expressions)
Returns a query in the form:NOT (a OR b OR c)
with a,b and c being expressions provided.static java.lang.String
orTagQuery(java.lang.String... tags)
static java.lang.String
orTagQuery(java.util.Collection<java.lang.String> tags)
static java.lang.String
parenThenJoinByAnd(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " AND " after wrapping each expression in parentheses.static java.lang.String
parenThenJoinByOr(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " OR " after wrapping each expression in parentheses.static java.lang.String
yearMonthRangeQuery(int year, int month)
Builds an item-date range query for items with a date occurring within the specified year and month.static java.lang.String
yearRangeQuery(int year)
Builds an item-date Nuix range query for items with a date occurring within the specified year.
-
-
-
Method Detail
-
yearRangeQuery
public static java.lang.String yearRangeQuery(int year)
Builds an item-date Nuix range query for items with a date occurring within the specified year.- Parameters:
year
- The year the range query should constrain to. Value should be a valid 4 digit year (2019 not 19).- Returns:
- A Nuix range query for item dates that occurred within the given year, i.e. item-date:[20190101 TO 20191231]
-
yearMonthRangeQuery
public static java.lang.String yearMonthRangeQuery(int year, int month)
Builds an item-date range query for items with a date occurring within the specified year and month. For example a year input of 2019 and month input of 6 should yield the query: item-date:[20190601 TO 20190630]- Parameters:
year
- The year the range query should constrain to. Value should be a valid 4 digit year (2019 not 19).month
- The month of the year, valid values are 1 through 12- Returns:
- A Nuix range query for items with an item date in the specified year and month
-
joinByAnd
public static java.lang.String joinByAnd(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " AND ", so expressions "cat", "dog" would become "cat AND dog". Nil/null values and values containing only whitespace characters in the provided expressions collection are ignored.- Parameters:
expressions
- Collection of expressions to join together.- Returns:
- The expressions AND'ed together.
-
parenThenJoinByAnd
public static java.lang.String parenThenJoinByAnd(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " AND " after wrapping each expression in parentheses. So expressions "cat", "dog" would become "(cat) AND (dog)". Nil/null values and values containing only whitespace characters in the provided expressions collection are ignored.- Parameters:
expressions
- Collection of expressions to join together.- Returns:
- The expressions surrounded by parentheses and AND'ed together.
-
joinByOr
public static java.lang.String joinByOr(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " OR ", so expressions "cat", "dog" would become "cat OR dog". Nil/null values and values containing only whitespace characters in the provided expressions collection are ignored.- Parameters:
expressions
- Collection of expressions to join together.- Returns:
- The expressions OR'ed together.
-
parenThenJoinByOr
public static java.lang.String parenThenJoinByOr(java.util.Collection<java.lang.String> expressions)
Joins a series of expressions by " OR " after wrapping each expression in parentheses. So expressions "cat", "dog" would become "(cat) OR (dog)". Nil/null values and values containing only whitespace characters in the provided expressions collection are ignored.- Parameters:
expressions
- Collection of expressions to join together.- Returns:
- The expressions surrounded by parentheses and OR'ed together.
-
notJoinByOr
public static java.lang.String notJoinByOr(java.util.Collection<java.lang.String> expressions)
Returns a query in the form:NOT (a OR b OR c)
with a,b and c being expressions provided.- Parameters:
expressions
- Expressions to be OR'ed and then NOT'ed.- Returns:
- A query in the form:
NOT (a OR b OR c)
-
notJoinByAnd
public static java.lang.String notJoinByAnd(java.util.Collection<java.lang.String> expressions)
Returns a query in the form:NOT (a AND b AND c)
with a,b and c being expressions provided.- Parameters:
expressions
- Expressions to be AND'ed and then NOT'ed.- Returns:
- A query in the form:
NOT (a AND b AND c)
-
namedEntityQuery
public static java.lang.String namedEntityQuery(java.util.Collection<java.lang.String> entityNames)
Generates a query to find items which have a match for any of the provided named entities.- Parameters:
entityNames
- List of entity names to search for, must be values recognized by Nuix- Returns:
- A query for items having matches for any of the specified named entities such as: named-entities:( company;* OR country;* OR credit-card-num;*)
-
markupSetQuery
public static java.lang.String markupSetQuery(nuix.MarkupSet markupSet)
-
escapeForSearch
public static java.lang.String escapeForSearch(java.lang.String value)
-
orTagQuery
public static java.lang.String orTagQuery(java.util.Collection<java.lang.String> tags)
-
orTagQuery
public static java.lang.String orTagQuery(java.lang.String... tags)
-
-