Package org.apache.ignite.cache.query
Class TextQuery<K,V>
- java.lang.Object
-
- org.apache.ignite.cache.query.Query<javax.cache.Cache.Entry<K,V>>
-
- org.apache.ignite.cache.query.TextQuery<K,V>
-
- All Implemented Interfaces:
Serializable
public final class TextQuery<K,V> extends Query<javax.cache.Cache.Entry<K,V>>
Full Text Queries
Ignite supports full text queries based on Apache Lucene engine. Note that all fields that are expected to show up in text query results must be annotated withQueryTextFieldQuery usage
Ignite TextQuery supports classic Lucene query syntax. See Lucene classic MultiFieldQueryParser and StandardAnalyzer javadoc for details. As an example, suppose we have data model consisting of'Employee'class defined as follows:public class Person { private long id; private String name; // Index for text search. @QueryTextField private String resume; ... }Here is a possible query that will use Lucene text search to scan all resumes to check if employees haveMasterdegree:Query<Cache.Entry<Long, Person>> qry = new TextQuery(Person.class, "Master"); // Query all cache nodes. cache.query(qry).getAll();- See Also:
IgniteCache.query(Query), Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.cache.query.Query
DFLT_PAGE_SIZE
-
-
Constructor Summary
Constructors Constructor Description TextQuery(Class<?> type, String txt)Constructs query for the given search string.TextQuery(Class<?> type, String txt, int limit)Constructs query for the given search string.TextQuery(String type, String txt)Constructs query for the given search string.TextQuery(String type, String txt, int limit)Constructs query for the given search string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLimit()Gets limit to response records count.StringgetText()Gets text search string.StringgetType()Gets type for query.TextQuery<K,V>setLimit(int limit)Sets limit to response records count.TextQuery<K,V>setLocal(boolean loc)Sets whether this query should be executed on local node only.TextQuery<K,V>setPageSize(int pageSize)Sets optional page size, if0, then default is used.TextQuery<K,V>setText(String txt)Sets text search string.TextQuery<K,V>setType(Class<?> type)Sets type for query.TextQuery<K,V>setType(String type)Sets type for query.StringtoString()-
Methods inherited from class org.apache.ignite.cache.query.Query
getPageSize, isLocal, prepare
-
-
-
-
Constructor Detail
-
TextQuery
public TextQuery(String type, String txt)
Constructs query for the given search string.- Parameters:
type- Type.txt- Search string.
-
TextQuery
public TextQuery(String type, String txt, int limit)
Constructs query for the given search string.- Parameters:
type- Type.txt- Search string.limit- Limits response records count. If 0 or less, considered to be no limit.
-
TextQuery
public TextQuery(Class<?> type, String txt)
Constructs query for the given search string.- Parameters:
type- Type.txt- Search string.
-
-
Method Detail
-
getType
public String getType()
Gets type for query.- Returns:
- Type.
-
setType
public TextQuery<K,V> setType(Class<?> type)
Sets type for query.- Parameters:
type- Type.- Returns:
thisFor chaining.
-
setType
public TextQuery<K,V> setType(String type)
Sets type for query.- Parameters:
type- Type.- Returns:
thisFor chaining.
-
getText
public String getText()
Gets text search string.- Returns:
- Text search string.
-
setText
public TextQuery<K,V> setText(String txt)
Sets text search string.- Parameters:
txt- Text search string.- Returns:
thisFor chaining.
-
getLimit
public int getLimit()
Gets limit to response records count.- Returns:
- Limit value.
-
setLimit
public TextQuery<K,V> setLimit(int limit)
Sets limit to response records count.- Parameters:
limit- If 0 or less, considered to be no limit.- Returns:
thisFor chaining.
-
setPageSize
public TextQuery<K,V> setPageSize(int pageSize)
Sets optional page size, if0, then default is used.- Overrides:
setPageSizein classQuery<javax.cache.Cache.Entry<K,V>>- Parameters:
pageSize- Optional page size.- Returns:
thisfor chaining.
-
setLocal
public TextQuery<K,V> setLocal(boolean loc)
Sets whether this query should be executed on local node only.
-
-