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 with `QueryTextField`

  ## Query 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 have `Master` degree:

       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 and 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 and Description
    --- | ---
    `int` | `getLimit()` Gets limit to response records count.
    `String` | `getText()` Gets text search string.
    `String` | `getType()` 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, if `0`, 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.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.ignite.cache.query.Query

      `getPageSize, isLocal, prepare`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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.

    - #### TextQuery

          public TextQuery(Class<?> 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.

  - ### 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:
        `this` For chaining.

    - #### setType

          public TextQuery<K,V> setType(String type)

      Sets type for query.
      Parameters:
        `type` - Type.
      Returns:
        `this` For 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:
        `this` For 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:
        `this` For chaining.

    - #### setPageSize

          public TextQuery<K,V> setPageSize(int pageSize)

      Sets optional page size, if `0`, then default is used.
      Overrides:
        `setPageSize` in class `Query<javax.cache.Cache.Entry<K,V>>`
      Parameters:
        `pageSize` - Optional page size.
      Returns:
        `this` for chaining.

    - #### setLocal

          public TextQuery<K,V> setLocal(boolean loc)

      Sets whether this query should be executed on local node only.
      Overrides:
        `setLocal` in class `Query<javax.cache.Cache.Entry<K,V>>`
      Parameters:
        `loc` - Local flag.
      Returns:
        `this` for chaining.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Query<javax.cache.Cache.Entry<K,V>>`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020