Gravatar for gling@houstonmethodist.org

Question by qch1595, Jan 30, 2017 5:23 PM

How to search REST API with multiple sources

I know how it works for a single source: http://myHostname/coveo/rest?q=@syssource=="source name" What if I need to search something within multiple sources? Like @syssource=="source1" AND @syssource=="source2"? "AND" doesn't work in the query.

2 Replies
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Jan 31, 2017 7:42 AM

As specified in the query syntax reference, you can query for a field with any of some specific values using this syntax:

@syssource==(source1, source2)

Note that using AND like you do means that the query will ask for documents that has BOTH @syssource=="source1" AND @syssource=="source2" (also specified in the query syntax reference), which will never happen because a document will always have only one source. Changing it for the OR operator would work, but I would suggest the first syntax I provided since it is a little more succinct and readable.

It would really help you to read some parts of the Getting Started with Queries guide as most basic answers about queries can be found there.

Cheers!

Gravatar for gminero@coveo.com

Answer by gminero, Jan 30, 2017 7:03 PM

Please take a moment to review this article, it should give you a general idea on how to add/manage multiple query parameters.

Ask a question