coveo

How to query Coveo rest API to lookup for a value in more than single field?


I have the following records in Coveo,

Record 1
@firstname = "Steve"
@lastname = "Jobs"
@fullname = "Steve Jobs"

Record 2
@firstname = "Jose"
@lastname = "Steve"
@fullname = "Jose Steve"

Record 3
@firstname = "Joe"
@lastname = "Brian"
@fullname = "Joe Brain"

I would like to query to get both "Steve Jobs" & "Jose Steve".

Should the query be like this (@lastname = "steve" or @firstname = "steve")???

or Do I have any other option???


Solution

  • In the Coveo query syntax, the "=" operator is the "contains keyword" operator. This means you can just use your @fullname field like this:

    @fullname = "steve"
    

    It will give the same results as the query you suggested:

    @lastname = "steve" OR @firstname = "steve"
    

    Note that Boolean operators need to be in uppercase in the Coveo query syntax.

    More information about the Coveo query syntax and operators: