# Retail V2 API - Class Google::Cloud::Retail::V2::Rule::FilterAction (v2.9.0)

2.9.0 (latest) 2.8.1 2.7.0 2.6.1 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.3.0 1.2.0 1.1.0 1.0.1 0.21.0 0.20.0 0.19.0 0.18.2 0.17.0 0.16.1 0.15.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.4 Reference documentation and code samples for the Retail V2 API class Google::Cloud::Retail::V2::Rule::FilterAction.

- Rule Condition:

  - No [Condition.query_terms](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Condition#Google__Cloud__Retail__V2__Condition_query_terms_instance_ "Google::Cloud::Retail::V2::Condition#query_terms (method)") provided is a global match.
  - 1 or more [Condition.query_terms](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Condition#Google__Cloud__Retail__V2__Condition_query_terms_instance_ "Google::Cloud::Retail::V2::Condition#query_terms (method)") provided are combined with OR operator.
- Action Input: The request query and filter that are applied to the
  retrieved products, in addition to any filters already provided with the
  SearchRequest. The AND operator is used to combine the query's existing
  filters with the filter rule(s). NOTE: May result in 0 results when
  filters conflict.

- Action Result: Filters the returned objects to be ONLY those that passed
  the filter.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #filter

    def filter() -> ::String

**Returns**

- (::String) --- A filter to apply on the matching condition results. Supported features:

  - [filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Rule-FilterAction#Google__Cloud__Retail__V2__Rule__FilterAction_filter_instance_ "Google::Cloud::Retail::V2::Rule::FilterAction#filter (method)") must be set.
  - Filter syntax is identical to [SearchRequest.filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest#Google__Cloud__Retail__V2__SearchRequest_filter_instance_ "Google::Cloud::Retail::V2::SearchRequest#filter (method)"). For more information, see [Filter](https://docs.cloud.google.com/retail/docs/filter-and-order#filter).
  - To filter products with product ID "product_1" or "product_2", and color "Red" or "Blue":  
    *(id: ANY("product_1", "product_2"))* *AND* *(colorFamilies: ANY("Red", "Blue"))*

### #filter=

    def filter=(value) -> ::String

**Parameter**

- **value** (::String) ---

  A filter to apply on the matching condition results. Supported features:
  - [filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Rule-FilterAction#Google__Cloud__Retail__V2__Rule__FilterAction_filter_instance_ "Google::Cloud::Retail::V2::Rule::FilterAction#filter (method)") must be set.
  - Filter syntax is identical to [SearchRequest.filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest#Google__Cloud__Retail__V2__SearchRequest_filter_instance_ "Google::Cloud::Retail::V2::SearchRequest#filter (method)"). For more information, see [Filter](https://docs.cloud.google.com/retail/docs/filter-and-order#filter).
  - To filter products with product ID "product_1" or "product_2", and color "Red" or "Blue":  
    *(id: ANY("product_1", "product_2"))* *AND* *(colorFamilies: ANY("Red", "Blue"))*
**Returns**

- (::String) --- A filter to apply on the matching condition results. Supported features:

  - [filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Rule-FilterAction#Google__Cloud__Retail__V2__Rule__FilterAction_filter_instance_ "Google::Cloud::Retail::V2::Rule::FilterAction#filter (method)") must be set.
  - Filter syntax is identical to [SearchRequest.filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest#Google__Cloud__Retail__V2__SearchRequest_filter_instance_ "Google::Cloud::Retail::V2::SearchRequest#filter (method)"). For more information, see [Filter](https://docs.cloud.google.com/retail/docs/filter-and-order#filter).
  - To filter products with product ID "product_1" or "product_2", and color "Red" or "Blue":  
    *(id: ANY("product_1", "product_2"))* *AND* *(colorFamilies: ANY("Red", "Blue"))*