Updated on Sep 14, 2023

1

min read

API (/search)

GET

Updated on Sep 14, 2023

1

min read

API (/search)

GET

Updated on Sep 14, 2023

1

min read

API (/search)

GET

GET /search/[collection_id]

Searches through the processed documents based on the query parameters.

URL:

GET https://api.vesana.dev/v1/search/[collection_id]

Headers:

x-Vesana-API-key: YOUR_API_KEY

Query Parameters:

  • text (str): The text to search for

  • sql (str): SQL query to run against the dataset

  • level (int): The level of granularity for the search (default=1, root doc)

  • count (int): The number of documents to return

  • num_chunks (int): The number of chunks to include in the results, if level != 1 (e.g. in a case where level=3 is "paragraph", how many paragraphs to get before and after the matching paragraph)

Response:

{ "status": "success", "results": [ { "document_id": "string", "text": "string", "metadata": "JSON" }, ... ] }

Example:

GET /v1/search/4321?text=example&sql="AuthorName='Tolkien' and Year<1960"&count=2 HTTP/1.1 Host: api.yourdomain.com x-Vesana-API-key: YOUR_API_KEY

Response:

{ "status": "success", "results": [ { "document_id": "12345", "text": "When Mr. Bilbo Baggins...", "metadata": { "title": "The Lord of the Rings", "author": "Tolkien", "tags": ["example", "document"] } }, { "document_id": "67890", "text": "Another sample text...", "metadata": { "title": "Another Title", "author": "Another Author", "tags": ["sample", "data"] } } ] }

See https://vesana.dev/docs/auth-error for error details in case of "status": "error"

GET /search/[collection_id]

Searches through the processed documents based on the query parameters.

URL:

GET https://api.vesana.dev/v1/search/[collection_id]

Headers:

x-Vesana-API-key: YOUR_API_KEY

Query Parameters:

  • text (str): The text to search for

  • sql (str): SQL query to run against the dataset

  • level (int): The level of granularity for the search (default=1, root doc)

  • count (int): The number of documents to return

  • num_chunks (int): The number of chunks to include in the results, if level != 1 (e.g. in a case where level=3 is "paragraph", how many paragraphs to get before and after the matching paragraph)

Response:

{ "status": "success", "results": [ { "document_id": "string", "text": "string", "metadata": "JSON" }, ... ] }

Example:

GET /v1/search/4321?text=example&sql="AuthorName='Tolkien' and Year<1960"&count=2 HTTP/1.1 Host: api.yourdomain.com x-Vesana-API-key: YOUR_API_KEY

Response:

{ "status": "success", "results": [ { "document_id": "12345", "text": "When Mr. Bilbo Baggins...", "metadata": { "title": "The Lord of the Rings", "author": "Tolkien", "tags": ["example", "document"] } }, { "document_id": "67890", "text": "Another sample text...", "metadata": { "title": "Another Title", "author": "Another Author", "tags": ["sample", "data"] } } ] }

See https://vesana.dev/docs/auth-error for error details in case of "status": "error"

GET /search/[collection_id]

Searches through the processed documents based on the query parameters.

URL:

GET https://api.vesana.dev/v1/search/[collection_id]

Headers:

x-Vesana-API-key: YOUR_API_KEY

Query Parameters:

  • text (str): The text to search for

  • sql (str): SQL query to run against the dataset

  • level (int): The level of granularity for the search (default=1, root doc)

  • count (int): The number of documents to return

  • num_chunks (int): The number of chunks to include in the results, if level != 1 (e.g. in a case where level=3 is "paragraph", how many paragraphs to get before and after the matching paragraph)

Response:

{ "status": "success", "results": [ { "document_id": "string", "text": "string", "metadata": "JSON" }, ... ] }

Example:

GET /v1/search/4321?text=example&sql="AuthorName='Tolkien' and Year<1960"&count=2 HTTP/1.1 Host: api.yourdomain.com x-Vesana-API-key: YOUR_API_KEY

Response:

{ "status": "success", "results": [ { "document_id": "12345", "text": "When Mr. Bilbo Baggins...", "metadata": { "title": "The Lord of the Rings", "author": "Tolkien", "tags": ["example", "document"] } }, { "document_id": "67890", "text": "Another sample text...", "metadata": { "title": "Another Title", "author": "Another Author", "tags": ["sample", "data"] } } ] }

See https://vesana.dev/docs/auth-error for error details in case of "status": "error"