Perceptive Enterprise Search - REST

Developer's Guide

This section gives an overview of how to call the Perceptive Enterprise Search REST Site from your application, including how to construct a request and the XML that will be returned.

REST Server URL

http://ec2-54-69-67-21.us-west-2.compute.amazonaws.com/search

Creating a REST Request

You can communicate with REST server can by POSTing or constructing a URL with the parameters encoded. This means you can easly construct a request that will work directly from your web browser, or embedded in your application. There is no dependency on SOAP web service libraries.

Request

This solution is designed to accept query input as either GET or POST attributes to the URL: http://server[:port]/search

The available search options are as follows:

OptionDescription
IW_INDEXSemicolon delimitated list of content sources (indexes) to search
IW_FIELD_TEXTSpecifies the query to execute using the Perceptive Enterprise Search query syntax
IW_FIELD_WEB_STYLESpecifies the query to execute using a more Internet style search syntax.
IW_FIELD_NATURAL_LANGUAGESpecifies the query to execute using a natural language format.
IW_SORTThe sort method to use. Can be relevance, date or any metdata field.
IW_BATCHSIZEThe number of items per page.
IW_CONFLATIONThe level of conflation (stemming) to use in the search, can be Broad, Narrow, Plurals of Off.

Please note there is a complete list of options in the Perceptive Enterprise Search help.

To implement advanced search style forms, you may also use IW_FIELD_IN_FIELDNAME, to constrain the query to a particular field. For example, to search for all documents authored by Peter Abbot about Dugongs, the URL would be:

?IW_INDEX=TRIM&IW_FIELD_WEB_STYLE=dugong&IW_FIELD_IN_AUTHOR=Peter+Abbot

Response

<?xml version="1.0" encoding="utf-8"?>

<response code="200">

  <nextpage>/url_to_next_page?page=2</nextpage>

  <pageurl>/url_to_next_page?page=%PAGENUM%</pageurl>

  <error></error>

  <resultlist start="1" count="10" total="2321" hitcount="12021">

 

    <result>

      <filename></filename>

      <summary></summary>

      <date></date>

      <size></size>

      <title></title>

      <url></url>

      <textview></textview>

      <download></download>

      <collection></collection>

      <format code=""></format>

      <category></category>

      <score></score>

     

      <metadata>

        <result>

          <text></text>

          <count></count>

        </result>

      </metadata>

      <related>

        <result>

          <title></title>

          <url></url>

        </result>

      </related>

    </result>

     

  </resultlist>

 

  <spelling>

    <text></text>

    <url></url>

  </spelling>

 

  <refinements>

    <section name="Are you looking for?" type="lookingfor">

      <result>

        <text>?</text>

        <count></count>

        <url></url>

      </result>

    </section>

    <section name="Categories" type="category">

      <result>

        <text>?</text>

        <count>?</count>

        <url></url>

      </result>

    </section>

    <section name="Metadata Field" type="metadata:fieldname">

      <result>

        <text></text>

        <count></count>

        <url></url>

      </result>

    </section>

    <section name="People" type="entity:people">

      <result>

        <text></text>

        <count></count>

        <url></url>

      </result>

    </section>

    <section name="Locations" type="entity:location">

      <result>

        <text></text>

        <count></count>

        <url></url>

      </result>

    </section>

    <section name="WebSites" type="entity:website">

      <result>

        <text></text>

        <count></count>

        <url></url>

      </result>

    </section>

    <section name="Organizations" type="entity:organization">

      <result>

        <text></text>

        <count></count>

        <url></url>

      </result>

    </section>

    <section name="Emails" type="entity:email">

      <result>

        <text></text>

        <count></count>

        <url></url>

      </result>

    </section>

  </refinements>

</response>

The response is broken down into two distinct sections, the found results for the executed search <resultlist>; and the refinement options for the executed search <refinement>. The default server website currently renders the results in the left-hand section of the screen with around 70% of the real estate and the refinement to the right with 30% of the real estate.

<response> element

The <response> node is the top level node of the XML response; it has a single attribute of "code" indicating the status. The code may be:

The response node can have one of each of the following nodes:

NodeDescription
<resultlist>contains the found results for the executed search
<error>contains any error text if the search did not execute
<refinement>contains the refinement options for the executed search
<spelling>contains spelling suggestion if one is available
<nextpage>contains the URL to fetch the next page of results
<pageurl>contains a template that can be used to navigate to a specific result page, replace %PAGENUM% with the page you wish to seek to

<resultlist> element

The <resultlist> node contains one or more <result> nodes representing the found items in the result set.

The <resultlist> node can have the following attributes:

AttributeDescription
startIndicates the index of the first item in the result list, starting from 1.
countIndicates the number of items returned in this request.
totalIndicates the total number of items found by this search.
hitcountIndicates the total number of search terms found in this search.

<resultlist><result> elements

The <result> node represents a single item found in the result list, its children nodes contain data about the document. The <result> node can have one of each of the following:

AttributeDescription
filenameThe filename of the result, as reported by the original document repository
summaryAbstract with the found keywords highlighted
dateThe date of the document, when available, will be in the format of yyyy-mm-dd hh:mm:ss
titleThe stored title of the document
urlA URL that can be used to download the original (native) document
textviewA URL that can be used to download a HTML text view of the document, with hits highlighted
downloadA URL that can be used to download the binary document when available
collectionThe index where the document was found
formatThe format of the document, the code attribute will contain the document format code, the text of the node will contain the display name
categoryThe category in which this document belongs
scoreThe calculated relevance score of the document, between 1 and 100
metadataContains a collection of metadata stored for the document

<refinement> element

The refinement node contains a collection of refinement options available on this result list; each option is separated into its own <section> node. The current sections are:

NodeDescription
<section type="lookingfor">Are you looking for?
<section type="category">Categories
<section type="metadata:fieldname">Metadata refinement options, the fieldname after the colon will contain the stored metadata field.
<section type="entity:entitytype">Entities, broken down by people, location, organization, website and email

Each <section> node will have one or more <result> nodes.

<refinement><section><result> element

The <result> node contained within a <section> will have the following child nodes: <text> Display text. For example, on an entity it may be "John Smith" <count> The number of occurrences of this refinement option in the current result set <url> A URL that can be fetched to return the XML of the refined search results

<spelling> element

The spelling node will be present if the search engine believes there is a possible spelling error in the query. It contains two possible child nodes:
NodeDescription
<text>Contains the alternate query text
<url>Contains the URL that can be used to return the XML results based on the alternate query

<error> element

The error node will be present if the response code is 500. This will indicate the reason that the search failed, this may include:

<nextpage> element

The next page node contains the URL that can be used to fetch the next page of results for this query.

<pageurl> element

The page URL node contains a template that can be used to navigate to a specific page in the result set. For example, if you wish to jump straight to page 10. To use, do a string replace on "%PAGENUM%" with the page you wish to jump to.



(c) 2015 Lexmark International Technology, S.A. All rights reserved.