Handling Errors When Querying

Unless the system encounters a configuration error (such as a bad macro or operator reference, a missing attribute in a structured query, etc.), the query-search function does not generate an exception. Because multiple sources can be queried simultaneously, query-search returns something that is potentially usable to the user, even if it returns only a partial result, rather than completely failing.

Error checking for the sources (and the search collections that are associated with them) is done by reviewing the status of the added-source elements in the response.

XML message:


      <query-results>
      ...
      <added-source name="my-new-collection" type="vse"
      modified="1229380810" modified-by="joe-user@vivisimo" status="queried"
      requested="10"
      >
      <parse
      url="http://127.0.0.1:7123/search?query-xml=%3cterm_field%3d%22query..."
      start-time="24" end-time="25" body-length="0" status="connection-failed"
      />
      </added-source>
      <added-source name="source-with-typo" status="unknown" />
      </query-results>

There are many ways to check that a source returned query results properly. For search engine collections, the easiest way to verify this is to check for the existence of the total-results property. For federated sources, or to simply obtain more detailed information, you should inspect the status property of the parse sub-elements.