Statement Search
The StatementApi allows you to search for and parse data at the statement level. In this guide, we will go over some of the properties you can use to filter your statement search. A full listing of the accepted properties can be found on the search for statements reference page.
Setting Up
Make sure you have already followed the instructions for importing dependencies and authentication from the Getting Started Guide. Once you have completed that, instantiate the StatementApi as shown below.
statements = layar_api.StatmentApi(client)
Check Your References
Make sure you have imported the
layar_api
and built out yourclient
object before instantiating the StatementApi. If you need help setting these up check out Installing the Layar API and Configure Your Instance in our Getting Started Guide
Searching for Statements
The statement_search
method allows you to find all statements in a set of documents or containing a query string. You can pass your parameters to the method with a StatementSearchObject.
body = layar_api.StatementSearchObject()
Search By Query String
Similar to the Paragraph Search you have the ability to search for statements with a query string. This time though, we'll attach the string to the q
property of the StatementSearchObject.
body.q = 'My query string'
Search By Document
If you would like a listing of all the statements in a specific document or group of documents, you can pass a list of document IDs as strings to the document_ids
property.
body.document_ids = ['document_1', 'document_2']
Once you have set your parameters you can pass the StatementSearchObject to the statement_search
method.
result = statements.statement_search(body)
Updated 12 months ago