Gravatar for deepak.raghav87@gmail.com

Question by deepak_raghav, Dec 26, 2014 8:51 AM

How to Filter the Results based in the value on a field

I'm Querying the Coveo Rest API in my application and i'm trying to refine or filter the result set based on a value coming in one of the fields returned in the search result.

Example, I have a field named "fxxx" and it is coming in the search results when querying the Rest API. Now I want to filter the search result such that I want only those search results to be returned those are having a specific value in that field, like "fxxx" == some value.

So how can I query the Rest API and get the results having "fxxx" == some value. Please help me in forming that query.

1 Reply
Gravatar for slangevin@coveo.com

Answer by Simon, Dec 26, 2014 9:42 AM

Hi Deepak,

This is the guide you are looking for: https://developers.coveo.com/display/public/SearchREST/Query+Parameters

There are several ways to filter but look at this part of the guide:


"aq: Advanced query expression This is the part of the query expression generated by code based on various rules.
Example: Selecting a facet value will cause an expression to be added to the advanced query expression. "

A facet is a UI compnonent which sends an under-the-blanket filter query, so you could use an Avanced query expression combined with your original query to filter down.

Cheers, Simon

Gravatar for deepak.raghav87@gmail.com

Comment by deepak_raghav, Dec 26, 2014 1:04 PM

Simon, I saw the site you sent but there was no example in that so when I try to query the rest api i'm not able to exactly form a query with the parameter. can you give me some syntax of using that.

Gravatar for slangevin@coveo.com

Comment by Simon, Dec 26, 2014 2:06 PM

Here is a URL example with an Item called MyTestPage in my web database:

http://localhost:8080/rest/search?q=MyTestPage&aq=@fdatabasename40744="web"

Gravatar for deepak.raghav87@gmail.com

Comment by deepak_raghav, Dec 27, 2014 12:42 PM

Simon, its working now

Ask a question