Gravatar for gling@houstonmethodist.org

Question by qch1595, Jan 30, 2017 12:31 PM

How to search rest api in a specific source

I have multiple sources(Sitecore internal sources and external data sources). How to use the Coveo REST API to search something in a specific data source or sources? I saw someone mentioned @syssource=="source name", but I am not sure how to use it in my query.

Thanks.

1 Reply
Gravatar for dberube@coveo.com

Answer by Dominic Berube, Jan 30, 2017 12:42 PM

Hi,

You simply have to pass it in the 'q=' parameter:

http://myHostname/coveo/rest?q=@syssource=="source name"

You can do this for any @field

Gravatar for gling@houstonmethodist.org

Comment by qch1595, Jan 30, 2017 12:48 PM

Thanks. But what if I need to search a key word "student" in the "source name"?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 30, 2017 12:58 PM

You simply add the keyword after the source name expression. A space between two words/expressions is an implicit AND boolean operator.

http://myHostname/coveo/rest?q=@syssource=="source name" student
Gravatar for gling@houstonmethodist.org

Comment by qch1595, Jan 30, 2017 2:01 PM

Thanks! Are there any samples for the REST API basic queries and advanced queries? So I could read it first before I ask questions.

Gravatar for flguillemette@coveo.com

Comment by François Lachance-Guillemette, Jan 30, 2017 2:33 PM

Here is the getting started guide for Coveo Enterprise Search: https://onlinehelp.coveo.com/en/ces/7.0/user/basic_search.htm

Most things in there are still valid regardless of what Coveo product you are using.

Here are the link to some examples: https://onlinehelp.coveo.com/en/ces/7.0/user/searchqueryexamples.htm

Feel free to read some of these sections as it covers the basics of the search engine and it should prove useful to you :)

Hope this helps!

Gravatar for gling@houstonmethodist.org

Comment by qch1595, Jan 30, 2017 4:21 PM

One more question: how to search 2 or more sources at the same time? Like @syssource=="source1" AND @syssource=="source2"? "AND" doesn't work in the query.

Gravatar for dberube@coveo.com

Comment by Dominic Berube, Jan 30, 2017 4:33 PM

@syssource==("source1", "source2")

Ask a question