MATIH Platform is in active MVP development. Documentation reflects current implementation status.
12. AI Service
Search Endpoints

Search Endpoints

The Search API provides semantic and keyword search capabilities across schemas, conversations, knowledge bases, and documentation. It uses Qdrant vector storage for embedding-based retrieval combined with keyword filtering for hybrid search results.


Semantic Search

Performs a semantic search across schema embeddings, conversation history, and knowledge bases using vector similarity.

PropertyValue
MethodPOST
Path/api/v1/search/semantic
AuthJWT required

Request Body

{
  "query": "customer revenue by region",
  "tenant_id": "acme-corp",
  "collections": ["schema", "conversations", "knowledge"],
  "top_k": 10,
  "min_score": 0.7,
  "filters": {
    "schema_type": "table"
  }
}

Response

{
  "results": [
    {
      "id": "tbl-sales-001",
      "collection": "schema",
      "content": "sales table with columns: customer_id, region, revenue, order_date",
      "score": 0.94,
      "metadata": {
        "table_name": "sales",
        "schema": "public",
        "column_count": 12
      }
    }
  ],
  "total": 5,
  "execution_time_ms": 45
}

Schema Search

Searches specifically within the tenant schema catalog for tables, columns, and relationships.

PropertyValue
MethodGET
Path/api/v1/search/schema
AuthJWT required

Query Parameters

ParameterTypeRequiredDescription
qstringyesSearch query
tenant_idstringyesTenant identifier
typestringnoFilter by type (table, column, relationship)
limitintegernoMax results (default 20)

Response

{
  "results": [
    {
      "type": "table",
      "name": "customers",
      "schema": "public",
      "description": "Customer master data",
      "columns": ["id", "name", "region", "tier"],
      "relevance_score": 0.89
    }
  ]
}

Conversation Search

Searches within past conversation sessions for relevant questions and answers.

PropertyValue
MethodGET
Path/api/v1/search/conversations
AuthJWT required

Query Parameters

ParameterTypeRequiredDescription
qstringyesSearch query
tenant_idstringyesTenant identifier
user_idstringnoFilter by user
date_fromstringnoISO date lower bound
date_tostringnoISO date upper bound
limitintegernoMax results (default 10)

Response

{
  "results": [
    {
      "session_id": "sess-xyz789",
      "question": "What is our customer churn rate?",
      "answer": "The current customer churn rate is 4.2%...",
      "timestamp": "2025-03-10T14:30:00Z",
      "relevance_score": 0.87
    }
  ]
}

Knowledge Base Search

Searches the knowledge base for documentation, business definitions, and domain context.

PropertyValue
MethodGET
Path/api/v1/search/knowledge
AuthJWT required

Query Parameters

ParameterTypeRequiredDescription
qstringyesSearch query
tenant_idstringyesTenant identifier
categorystringnoFilter by category (glossary, metric, documentation)
limitintegernoMax results (default 10)

Hybrid Search

Combines semantic vector search with keyword filtering for maximum relevance.

PropertyValue
MethodPOST
Path/api/v1/search/hybrid
AuthJWT required

Request Body

{
  "query": "monthly active users by plan",
  "tenant_id": "acme-corp",
  "semantic_weight": 0.7,
  "keyword_weight": 0.3,
  "top_k": 10,
  "collections": ["schema", "knowledge"]
}

Response

The response format matches the semantic search response with an additional match_type field indicating whether each result was matched via semantic similarity, keyword matching, or both.