Gravatar for

Question by colema18, Aug 27, 2015 11:22 AM

Best way to get a document from a Coveo Index (C#)

I am creating a notification service in C# that, at a high-level, will get a document id from a database for which I need to say "Hey Coveo, what is the sysdate (last updated date) of the document that has this document id".

Our custom coveo search and subscription code so far has leveraged the Coveo JS Framework v1 (REST services). My notification service is really just all server-side and I wanted to know the best way to get an index entry (document) out of Coveo from C# server side code.

I could make my server make a RESTful call to the Coveo JS Framework but didn't want to jump through that extra hoop if there is a simple C# Coveo API where I can just do something like:

var indexItem = Coveo.GetDocument(indexCollection, documentId)

Thanks for the feedback / direction, ~james

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Aug 27, 2015 4:36 PM

Hi James,

If the document id you describe is a Coveo index document id, you can use the LoadDocument method of the Coveo Search Service to get that document from the index (see LoadDocument method).

The Coveo Search Service is a SOAP service directly embedded in CES (this is the service the Coveo Search API calls under the cover). It has a public API (see Data Types and Methods).

If your document id is not a Coveo index document id and is stored in a field on your Coveo documents, you'll need to query the index with the usual query syntax to find your document.

Instead of calling the REST Endpoint of the Coveo Search API, you could call the Coveo Search Service directly in your code. There is a documentation page that describes how to setup a Visual Studio project to call this service:

For the query to execute, I think you managed to find one that matches only the desired document in your RESTful implementation. You would use the same query.

If you need anything else, don't hesitate.


Gravatar for

Comment by colema18, Aug 28, 2015 8:58 AM

Thanks Jeff

Ask a question