Skip to main content
Credal | Documentation
current

Search documentation

Type to search this documentation.

Search Document Collection

POST/v0/search/searchDocumentCollectionSearch Document Collection

Search across all documents in a document collection using the document metadata and contents.

Request body

application/json
object
collectionIdstring · uuidrequired
metadataFilterExpressionstring

Legacy metadata filter expression to apply to the search query. Use structuredQueryFilters instead.

searchOptionsobject
Show child attributes
enableQueryExtractionboolean

/ Whether to extract search terms from the user query and use them for semantic search. Defaults to false.

enableRerankingboolean

Whether to rerank the search results after the initial semantic search query. Defaults to false.

enableSmartFilteringboolean

Whether to automatically filter the search results based on the user query and available metadata on the collection. Defaults to false.

maxChunksinteger

The maximum number of chunks to return. Defaults to 10.

mergeContentsboolean

Whether to merge the chunks for a document and just return one result per document. Defaults to false.

thresholdnumber · double

The similarity threshold between 0 and 1 for the search results. A higher number leads to fewer but more relevant results. Defaults to 0.45.

searchQuerystringrequired
structuredQueryFiltersarray of object

The structured query filters to apply to the search query.

Show child attributes
Show array items
fieldstringrequired
operatorstringrequired

one of "<", ">", "<=", ">=", "!=", "==", "contains"

valuestringrequired
userEmailstringrequired

The email of the user making the search request for permissions reduction.

Example request
{
  "collectionId": "00000000-0000-0000-0000-000000000000",
  "metadataFilterExpression": "string",
  "searchOptions": {
    "enableQueryExtraction": true,
    "enableReranking": true,
    "enableSmartFiltering": true,
    "maxChunks": 0,
    "mergeContents": true,
    "threshold": 0
  },
  "searchQuery": "string",
  "structuredQueryFilters": [
    {
      "field": "string",
      "operator": "!=",
      "value": "string"
    }
  ],
  "userEmail": "string"
}

Responses

200Response with status 200application/json
objectsearch_SearchDocumentCollectionResponse

SearchDocumentCollectionResponse

resultsarray of objectrequired
Show child attributes
Show array items
chunksarray of objectrequired
Show child attributes
Show array items
chunkIdstring · uuidrequired
chunkIndexintegerrequired
scorenumber · doublerequired

The similarity score between 0 and 1 for the search result. A higher number means the chunk is more relevant to the search query.

textstringrequired
documentExternalIdstringrequired
documentIdstring · uuidrequired
documentMetadataobjectrequired
documentNamestringrequired
documentUrlstringrequired
mergedContentsstring
searchIdstring · uuidrequired
searchTermsUsedarray of stringrequired
Show child attributes
structuredFiltersAppliedarray of objectrequired
Show child attributes
Example response
{
  "results": [
    {
      "chunks": [
        {
          "chunkId": "00000000-0000-0000-0000-000000000000",
          "chunkIndex": 0,
          "score": 0,
          "text": "string"
        }
      ],
      "documentExternalId": "string",
      "documentId": "00000000-0000-0000-0000-000000000000",
      "documentMetadata": {
        "additionalProp1": "string"
      },
      "documentName": "string",
      "documentUrl": "string",
      "mergedContents": "string"
    }
  ],
  "searchId": "00000000-0000-0000-0000-000000000000",
  "searchTermsUsed": [
    "string"
  ],
  "structuredFiltersApplied": [
    {
      "field": "string",
      "operator": "!=",
      "value": "string"
    }
  ]
}
Documentation menu