Search API
This webservice allows integration of Realviews search engine into client websites.
It is located at http://client.url/api/search.asmx
The service description is located at http://client.url/api/search.asmx?WSDL
Method : search
This method will search your publications text content.
Parameter | Value | Description |
PID | GUID | This is a unique key for each publication that allows access to the search. This will be supplied by Realview. |
Searchquery | SearchDetails | This class defines the parameters of the search. See below for a class definition. |
Return | resultdata[] | An array of type resultdata is returned by the function. |
Result: returns an array of search hits for the given search parameters. The results are grouped by page. If there are multiple hits on a single page they will be grouped.
Class : SearchDetails
This class defines how the search will be performed and how the results will be returned.
Parameter | Value | Description |
Searchterm | String | This is the term you are searching the index for. |
PublicationID | Int | This is your publications identifier. This must match the unique key for your publication. This will be supplied by Realview. |
Page | Int | Returns the given page of results if you are using paging. Default:1 |
PageSize | Int | The number of results in each page of results. Default 10 |
NumberResults | Int | Ignore. |
Top | Int | The total number of results for the query. Default:1000 |
CharsBefore | String | The number of characters before the search term in the text snippet to return. Default:50 |
CharsAfter | String | The number of characters after the search term in the text snippet to return. Default:50. |
OrderBy | String | This defines what order the results will be defined. Valid values are (rank|IssueDate ASC|DESC). Default “rank desc”. |
SearchPostfix | String | A html tag to insert after the hit in the text snippet. Default:</b> |
SearchPrefix | String | A html tag to insert before the hit in the text snippet. Default:<b> |
IssueToSearch | Int [] | An array of issue ids to search. This only searches the given issues and not the complete publication. If the array is empty all issues are searched. |
Class : resultdata
This class defines each search hit. Results are grouped by page.
Parmeter | Value |
|
Name | String | The name of the issue the hit is in. |
Thumb | String | An image url for the page the hit is on. |
Issuedate | Date | The date the issue was publisherd. |
Id | Int | The id of the issue the result was found in. |
Link | String | A url to the page the link was found on. |
Hits | String [] | An array of strings for each hit on the page. Each item contains a snippet of the search hit. |
Example:
search.api.SearchDetails sd = new search.api.SearchDetails();
sd.SearchTerm = "school";
sd.PublicationID = 2711;
sd.Page = 1;
sd.PageSize = 50;
sd.NumberResults = 50;
sd.Top = -1;
sd.CharsAfter = 50;
sd.CharsBefore = 50;
sd.OrderBy = "IssueDate Asc";
search.api.search searcher = new search.api.search();
search.api.resultdata[] results = searcher.Search(PID, sd);
for (int i = 0; i < results.Length; i++)
{
search.api.resultdata result = results[i];
string thumb_url = result.Thumb;
for (int j = 0; j < result.hits.Length; j++)
{
string hit_text = (string)result.hits[j];
}
// do something with the results
}
This example uses the VS2008 “Add Web Reference” to generate C# proxy classes for the webservice. wsdl2perl, wsdl2java should produce similar proxy classes for perl and java.
Method : GetIssues
This method will return all issues for your publication.
Parameter | Value | Description |
PID | GUID | This is a unique key for each publication that allows access to the getissues method. This will be supplied by Realview. |
Result: returns an array of issues for the publication. The array is ordered by issue date. The latest issue will be the first item in the array.
Class : issue
This class defines each issue returned.
Parmeter | Value |
|
Name | String | The name of the issue. |
Thumb | String | An thumbnail image url for the issue front cover. |
Issuedate | Date | The date the issue was publisherd. |
Id | Int | The id of the issue the result was found in. |
Link | String | A url to the front cover of the issue. |
Example:
search.api.search searcher = new search.api.search();
search.api.issue[] results = searcher.GetIssues(PID);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < results.Length; i++)
{
search.api.issue result = results[i];
string issue_name = result.name;
string thumb_url = result.thumb;
// do something with the results
}
This example uses the VS2008 “Add Web Reference” to generate C# proxy classes for the webservice. wsdl2perl, wsdl2java should produce similar proxy classes for perl and java.