Gravatar for rhowe@productiveedge.com

Question by howejr, Jun 8, 2015 3:20 PM

Query Custom Index

Hello,

I want to define a custom index and use the default renderings/controls provided by Coveo for Sitecore to query the index.

I'm not seeing any parameter to specify the index I want the search page to use. Is this possible to specify? What controls what index your searches are run against?

Thanks Ryan

Gravatar for om.gupta@hotmail.com

Comment by omgupta, Oct 19, 2018 8:38 PM

Refer below API, we have multiple index on coveo.. i need to execute search term query on specific index.. i am not able to see the option to pass the index name also in the query parameter..

How can we define the index name in the search query?

POST https://platform.cloud.coveo.com/rest/search/v2?q=test
<br>
1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jun 8, 2015 4:57 PM

Coveo for Sitecore automatically query against the first Coveo index that indexes the search page the user is visiting in the current Sitecore site's database.

Suppose you have a Sitecore site <site name="website" database="web" .../> and a search page in it. When a visitor visits the search page, Coveo for Sitecore will query the first Coveo index that indexes the web database.

However, when you edit this search page in the Content Editor or view it in preview mode, the current Sitecore site is "admin" and its database is "master". Coveo for Sitecore queries the first Coveo index that indexes the master database.

For the moment, this behavior is not configurable. We are working on a feature to let the administrator choose a search index for every Coveo Search component.

Can you give me more context for your separate index? Why can't you use the default web and master indexes?

Gravatar for rhowe@productiveedge.com

Comment by howejr, Jun 8, 2015 5:07 PM

We are creating a website and want to provide search against specific areas of the tree and in general just felt as though the configuration would be best separated out. I'm seeing an Index Name parameter in the April release of Coveo (I'm still on an older release). Is this not what I'm looking for?

If I don't specify custom indexes, am supposed to just use Filtering Expressions to attempt to only include the item types I wish?

Thanks for your help… Ryan

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jun 8, 2015 5:17 PM

Hi Ryan,

You are right. Filtering on the Coveo Search component is the right way to limit the results on a search page. What you are looking for is probably the "where the item is the specific item or one of its subitems" filtering rule. If you are using the Free Edition, you would have to add your filtering rules in the sublayout/view file in JavaScript.

The April 2015 release doesn't contain the feature I was talking about. It is in early stage of development as we speak.

Gravatar for rhowe@productiveedge.com

Comment by howejr, Jun 9, 2015 12:37 PM

So overall, if we are trying to provide a search experience for a website we are creating in Sitecore, and we are using the free edition of Coveo, are we better off using the components provides by Coveo or just writing something from scratch? We can't target a specific index? We have to customize the component with Javascript to limit the results to valid pages as opposed to all the miscellaneous items? I'm guessing the free edition is mostly for a replacement for search inside the Sitecore authoring client and if you really want to use it for anything you are developing you probably need the paid version. Is this fair? Am I misunderstanding something? Thanks for your help.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jun 9, 2015 1:13 PM

Even with the free edition of Coveo for Sitecore, it is recommended to use the Coveo for Sitecore UI components. The free edition targets developers that wants to try the product and use it without analytics, external sources and personalization. It requires minimal JavaScript code customization to achieve filtering and boosting of the search results.

The enterprise edition is there to enable analytics, external sources, personalization and allow the content editors to filter/boost the search results with a nice rule editor that outputs the right JavaScript code in the search page.

Gravatar for rhowe@productiveedge.com

Comment by howejr, Jun 9, 2015 1:14 PM

ok, thank you…

Ask a question