Search documents

Find which of your documents likely answer each question, without searching their pages: to choose which to search, or to show a person which documents to read.

found = client.documents.search("What was capital expenditure in 2018?", collection=reports, filter={"year": 2018})

for match in found.results[0].documents:
    print(match.filename, match.relevance)
  • It takes the same scopes as a search of pages, except one document (see Choose the documents). In Python, pass a list of documents as document_ids=.
  • Each question lists the documents likely to help, most relevant first, each with its relevance. It may list none, when no document is likely to: more_documents lists the next most relevant, up to 10, to look at if the question is worded unlike them.
  • top_k: list exactly this many documents instead, the most relevant.
  • A document's file name and metadata count, so name and tag documents well (see Organize documents).
  • Each document searched is priced as a document, whatever its length (see Pricing). With metadata, a filter that picks the documents out is free: list them instead.

Every field: API reference.