Package org.apache.uima.search

# Interface Filter

All Superinterfaces:
  `Serializable`, `XMLizable`

All Known Implementing Classes:
  `Filter_impl`

public interface Filter extends XMLizable, Serializable
Specifies a constraint that matches against annotations in the CAS. Filters are assigned to `IndexBuildItem`s in order to specify which annotation instances are subject to indexing according to the rule specified by the IndexBuildItem.

We support an open-ended schema for filters. Each Filter has a `syntax` declaration and an `expression`. Each are arbitrary strings. The syntax declaration is intended to tell the indexer how to interpret the expression. Any given indexer implementation will declare which syntaxes it supports.

The only syntax the indexers are required to import is the `FeatureValue` syntax, which permits very simple expressions that test the values of features. Expressions using this syntax take the form `<FeatureName> <Operator> <Literal>`, where FeatureName is a CAS feature name, Operator is either =, !=, <, <=, >, or ≥=, and Literal is an integer, floating point number (no exponent syntax supported) or string literal enclosed in double quotes, with embedded quotes and backslashes escaped by a backslash. For example, the following are valid filters:

- foo = "hello world"
- foo < 42
- bar7 = "\"Blah,\" he said."
- bar7 >= 0.5

This object implements the `XMLizable` interface and can be parsed from an XML representation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getExpression()`
  Gets the filter expression.
  `String`
  `getSyntax()`
  Gets the declared syntax for this filter's expression.
  `void`
  `setExpression(String aExpression)`
  Sets the filter expression.
  `void`
  `setSyntax(String aSyntax)`
  Sets the declared syntax for this this filter's expression.

  ### Methods inherited from interface org.apache.uima.util.XMLizable

  `buildFromXMLElement, buildFromXMLElement, toXML, toXML, toXML, toXML`

- ## Method Details

  - ### getSyntax

    String getSyntax()
    Gets the declared syntax for this filter's expression.
    Returns:
      an identifier indicating the syntax used by this filter

  - ### setSyntax

    void setSyntax(String aSyntax)
    Sets the declared syntax for this this filter's expression.
    Parameters:
      `aSyntax` - an identifier indicating the syntax used by this filter

  - ### getExpression

    String getExpression()
    Gets the filter expression. This is a string intended to be interpreted according to the `syntax`.
    Returns:
      the filter expression

  - ### setExpression

    void setExpression(String aExpression)
    Sets the filter expression. This is a string intended to be interpreted according to the `syntax`.
    Parameters:
      `aExpression` - the filter expression