Can anybody give some code sample to use EWS Search Service?
SearchService sService = new SearchService();
SingleSearchRequest ssRequest = new SingleSearchRequest();
???
sService.Search(ssRequest, ??);
Thanks!
At some point I hope to post a sample for the Search Service, but for now I'll do my best to help you out.
Just for context, I'm discussing this from the point of view of a generated WCF client proxy, but the concepts should be the same if you're using generated JAX-WS portable artifacts or something else.
There are several properties you need to set on your instance of SingleSearchRequest:
DataCollectionSpec: A comma-delimited, quoted list of slices to search (e.g. "\"LES Enterprise\", \"LES Help\"").
FirstResultToRetrieve: The first result to retrieve (e.g. 1).
NumResultsToRetrieve: The number of results to retrieve (e.g. 10).
QueryLanguage: For Search API-compatibility use "Livelink Search API V1".
ResultSetSpec: Your query (e.g. "where1=enterprise+web+services").
Then you can pass your request to the SearchService Search method, which returns an instance of SingleSearchRequest.Some things to note about the response (it's a little confusing, but I'll try to make it somewhat clear):
ResultAnalysis will contain an SGraph with a node (N) that has string fields (S) that contain the display names for the regions that are used in the response.
Type will contain a DataBagType with string fields (Strings) that contain the region names that are used in the response.
An SGraph node is parallel to the DataBagType where the Type property of the node is the same as the ID of the DataBagType. In the case of ResultAnalysis and Type, each element of S coresponds to an element of Strings. For example ResultAnalysis[0].N[0].S[0] is the display name for Type[0].Strings[0]. You'll note that ResultAnalysis ResultAnalysis[0].N[0].Type == Type[0].ID == "MRD".
Results is an instance of SResultPage.
Results.ListDescription property will contain information about the numbers of results returned and available.
Results.Item property will be an array of SGraphs with nodes (N) that are parallel to the DataBagType(s) defined in the Results.Type property. The fields of each node will give you the results and the fields of the DataBagType will give you the region names for the results.
I hope this helps to clear things up a little, but I realize it's a little complicated. Don't hesitate to post any questions as you proceed.
Scott
Scott,
Thank you so much for your efforts. I will try to understand your description and use this function.
I will let you once I have something new.
Yun
And could you tell me how could I perform an advanced search, looking for documents with a certain category and with a certain value inside a attribute of that category, through Search Service WS?
For example, given a category 'CAT' with an attribute 'A', search documents with category 'CAT' and value 'V' in attribute 'A'.
Hi, Francisco.
To search categories and attributes, you would have to construct a complex query using the region names for the categories (e.g. Attr_12345_6).
Hi Scott,
You gave an example how we can create a SingleSearchRequest object.
One thing i can't see is the property ResultSetSpec. Can you explain the convention? if i want to search for a folder by name what kind of convention should i use?
Thanks in advance.
Regards,
Dennis
Hello Dennis,
I can speak to your question about searchsyntax.
You can simply search the same way youwould in the GUI – using the Livelink Query Language.
For your listed example, a search for afolder (OTSubType=0) with the name “test folder” (OTName=”testfolder”) would simply be:
(OTSubType:0) AND (OTName:”testfolder”)
-- Kyle
From: eLink Entry:Enterprise Web Services 9.7.1 Forum[mailto:otdnenterprisewebservices971forum@elinkkc.opentext.com] Sent: Wednesday, June 24, 20094:20 AMTo: eLink RecipientSubject: EWS Search Service 2
EWS Search Service 2
Posted by sandra.donk@afm.nl (Donk, Sandra) On 2009/06/24 04:15
[To post a comment, use the normal reply function]
Topic:
EWS Search Service
Forum:
Enterprise Web Services 9.7.1 Forum
Livelink Server:
knowledge-wlweb01
This document might be useful in constructing the queries for ResultSetSpec:
https://knowledge.opentext.com/knowledge/llisapi.dll/Open/13621465
Kyle, Chris and Scott,
All thanks for your responses. This will help definitely. I couldn't find the documentation before so it's more then welcome.