TextQuery document (Data API 23.2)

A text query is used to match some text (i.e. a search phrase possibly consisting of multiple terms) against one or multiple fields. In case multiple fields are provided, the phrase conceptually forms a logical OR over the fields. In this case, the terms of the phrase basically have to match within the text, that would result in concatenating all given fields. Example: (coupon_id contains "xmas" )
    query: {
        text_query: {
            fields: ["coupon_id"],
            search_phrase: "xmas"
        }
    }
 
Example: (coupon_id contains "xmas" OR description contains "xmas")
    query: {
        text_query: {
            fields: ["description", "coupon_id"],
            search_phrase: "xmas"
        }
    }
 
Example: (description contains "holiday" AND description contains "bojo")
    query: {
        text_query: {
            fields: ["description"],
            search_phrase: "holiday bogo"
        }
    }
 
Property Type Constraints Description
fields [String] mandatory=true, minItems=1, nullable=false The document fields the search phrase has to match against.
search_phrase String mandatory=true, nullable=false A search phrase, which may consist of multiple terms.
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
Notifications pending to read 9