Help & DocumentationAI & Analytics

AI & Analytics

Understanding DocAssure's AI-powered document search and intelligent query system

Overview

DocAssure uses advanced AI technology to help you find and analyze documents quickly and accurately. The system automatically understands what type of question you're asking and chooses the best method to answer it - whether that's retrieving statistics in milliseconds or searching through document content using powerful AI models.

Key Benefit

The system works equally well whether you have 30 documents or 100,000 documents. Metadata queries return instantly, while content searches use intelligent indexing to find the most relevant documents in seconds, not minutes.

Intelligent Query Routing

When you ask a question, DocAssure's AI analyzes your query and automatically routes it to the optimal processing method. This happens invisibly and instantly - you just ask questions in natural language.

How It Works

  1. 1
    Intent Classification

    AI analyzes your query to understand what you're asking: statistics, content search, or analysis.

  2. 2
    Strategy Selection

    Chooses SQL (for fast statistics), Intelligent Search (for content search), or both strategies combined.

  3. 3
    Execution

    Runs the query using the optimal method - fast database queries or intelligent document retrieval.

  4. 4
    Result Formatting

    AI formats the results into clear, natural language answers tailored to your question.

Hybrid Search System

The Knowledge Engine is the technology that powers content-based searches. It combines intelligent document retrieval with AI generation to provide accurate, contextual answers based on your actual documents.

Two-Phase Architecture

Understanding these two phases explains why the system scales so well:

Phase 1: Retrieval

Fast & Scalable - Finds relevant documents using indexes, not reading full text.

  • • Searches using indexes only
  • • Returns document IDs + scores
  • • Works in milliseconds
  • • Scales to millions of documents

Phase 2: Generation

Smart & Contextual - Analyzes only the top matches to generate comprehensive answers.

  • • Fetches full text for top 15-20 docs
  • • Builds rich context (~150K chars)
  • • Uses advanced AI models
  • • Generates natural language answers

Why This Matters

Phase 1 ensures scalability by using indexes (not reading all documents). Phase 2 ensures accuracy by analyzing only the most relevant documents. This is why you get fast, accurate results even with large document collections.

Four Search Methods

DocAssure combines four complementary search methods to find the most relevant documents. Each method has strengths for different query types:

1. BM25 Keyword Search

Traditional keyword matching using PostgreSQL full-text search. Excellent for exact terms, technical jargon, and document codes.

Best for: "Find document ABC-123", "GDPR Article 6", "ISO 27001"

2. Vector Semantic Search

Understands meaning and context using vector embeddings. Finds conceptually similar documents even without exact keyword matches.

Best for: "Privacy requirements", "Financial obligations", "Security best practices"

3. Graph Entity Search

Finds documents through entity relationships stored in a knowledge graph. Discovers connected information and related documents.

Best for: "Documents mentioning Acme Corp", "Contracts with John Smith"

4. Vision-Aware Search

Searches OCR-extracted text from images, charts, and scanned documents. Makes visual content fully searchable.

Best for: Scanned PDFs, documents with images, charts and diagrams

Reciprocal Rank Fusion (RRF)

All four methods run in parallel, each scoring documents independently. RRF then combines these scores intelligently, ensuring the most relevant documents (regardless of which method found them) rise to the top of results.

Advanced Search Enhancements

DocAssure uses three advanced techniques to improve search quality beyond basic hybrid retrieval. These enhancements work automatically to maximize recall and accuracy.

Multi-angle Query Generation

When you submit a query, the system generates 4 alternative phrasings using AI. All variants are searched in parallel, then results are merged. This improves recall by 15-25%.

Example:

Original: "GDPR compliance requirements"

→ "Data protection regulation obligations"

→ "Privacy law compliance checklist"

→ "EU data privacy requirements"

Query-Adaptive Weights

The system analyzes your query type and adjusts the importance (weights) given to each of the four search methods. This ensures the most appropriate method dominates the results.

Query Type → Weight Adjustment:

keyword_heavy→ BM25 boosted (exact term matching)
conceptual→ Vector boosted (semantic understanding)
entity_focused→ Graph boosted (relationship discovery)
visual→ Vision boosted (image/chart content)

Recursive Question Answering

For complex questions requiring multiple steps or comparisons, the system automatically decomposes your query into sub-questions, answers each one, then synthesizes a comprehensive response.

Example Complex Query:

"Compare the data retention policies in the HR manual vs the IT security policy"

1. Find HR manual data retention section

2. Find IT security policy data retention section

3. Compare and synthesize differences

Triggers automatically when complexity score ≥ 60%

Query Analytics Dashboard

The Query Analytics dashboard (found under AI Intelligence → Query Analytics) provides visibility into how the AI processes your queries. Use it to understand system behavior and optimize your search strategy.

Dashboard Metrics Explained

Total Queries

The total number of AI Assistant queries processed in the selected time period.

Avg Response Time

Average time to complete queries. SQL queries are typically 10-50ms, while Hybrid RAG queries take 500ms-2s depending on complexity.

Avg Rating / Helpful %

User feedback metrics. Rate answers using the feedback buttons in the AI Assistant to improve these metrics and help the system learn.

Intent Distribution

Shows how your queries are classified by the intelligent router:

metadataRepository statistics & counts
retrievalContent search & document finding
analyticalComparisons & trend analysis
temporalTime-based queries
specificQuestions about selected documents

Strategy Distribution

Shows which execution strategy was used:

sqlFast database queries for metadata/statistics (10-50ms)
hybrid_ragFull 4-method search with AI answer generation (500ms-2s)
bothCombined approach for complex analytical queries

Method Effectiveness

Shows how often each of the four search methods returns results:

🔤 BM25Keyword matches - good for exact terms
🧮 VectorSemantic matches - good for concepts
🕸️ GraphEntity matches - good for people/orgs
👁️ VisionOCR matches - good for scanned docs
Note: Low usage of a method doesn't mean it's not working - it means your queries haven't needed that particular strength. For example, Vision is only heavily used when searching scanned documents or image content.

Recent Queries Table

Lists all recent queries with details. Click any row to see the full breakdown including:

  • Full query text and AI reasoning
  • Results count from each method
  • Timing breakdown per method
  • Multi-query variants used (if enabled)
  • Adaptive weights applied
  • Recursive QA sub-questions (for complex queries)
  • Answer preview

Using Analytics for Optimization

If you notice that retrieval queries are common but Method Effectiveness shows low results, your documents may need re-indexing. If specific intent dominates, consider asking broader questions to leverage the full hybrid search capability.

Understanding Query Types

The system classifies your questions into these categories and handles each optimally:

Metadata Queries

SQL Strategy

Questions about repository statistics, document counts, and summaries.

Example Questions:

  • • "How many documents do I have?"
  • • "What's my total storage usage?"
  • • "Give me a summary of all documents"
  • • "Documents by category breakdown"
Speed: 10-50msScales to: Any size

Retrieval Queries

Hybrid RAG

Searching for specific content or documents about particular topics.

Example Questions:

  • • "Find documents about GDPR compliance"
  • • "Show me data protection policies"
  • • "Documents mentioning privacy requirements"
  • • "Contracts from 2024"
Speed: 800ms-2sUses: Indexed search

Analytical Queries

SQL Analytics

Comparisons, trends, and aggregated analysis across documents.

Example Questions:

  • • "Compare document uploads by month"
  • • "Documents by department breakdown"
  • • "Q1 vs Q2 document volume"
  • • "Compliance documents by framework"
Speed: 50-200msUses: Aggregations

Scalability & Performance

DocAssure's search system scales efficiently from personal repositories to enterprise-scale collections. Here's how performance changes with repository size:

Repository SizeMetadata QueryContent SearchWhy It Works
30 documents~10ms~500msMinimal overhead
1,000 documents~15ms~600msIndexes provide O(log n)
10,000 documents~25ms~800msDB aggregations fast
100,000 documents~50ms~1200msVector DB scales well
1,000,000 documents~100ms~1500msHNSW algorithm

Important Note

For content searches, the AI analyzes only the top 15-20 most relevant documents (Phase 2), not all documents in your repository. Phase 1 identifies these top matches using fast indexes. This is why response times remain reasonable even with large collections.

Knowledge Graph & Whole-Repository Search

Doc-Assure retrieval is built in layers, because no single technique answers every kind of question. Pinpoint lookups, multi-document “how are these connected” questions, and whole-repository “what are the themes across everything” questions each need a different mechanism. The platform combines them so you get the right answer no matter how broad the question is.

The three layers

1. Semantic (vector) search + reranking — live today

Finds the passages that mean what you asked, then a reranker re-scores them for precision. Best for specific, local lookups (e.g. “what were the 2024 director emoluments?”). On its own this matches or beats graph methods for simple fact retrieval.

2. Knowledge graph (entities + relationships) — rolling out now

Recognises the key entities in every document — people, organisations, courts, parties, instruments, amounts, obligations, dates and concepts — and the relationships between them, into a graph that answers multi-hop, cross-document questions (e.g. “which directors sit on both boards?”, “which parties recur across our matters?”) that no single passage states. The schema is domain-agnostic — legal, financial, tender, privacy, construction, engineering, aviation, medical, any document type — captured as a universal entity type plus an open subtype, so a new domain needs no change.

3. Communities & global summaries — roadmap

Clusters the graph into themes and pre-writes a summary of each, so “what are the main risks across our entire repository?” can be answered by reasoning over the whole corpus — something pure search cannot do.

Under the hood — and why

Every component is self-hosted on Doc-Assure infrastructure (no external AI APIs), keeping all data inside the platform for POPIA compliance. The choices below were made from current (2025–2026) independent benchmarks, not vendor claims:

  • Hybrid retrieval, not graph-only. Independent benchmarks (GraphRAG-Bench, ICLR’26) show plain vector search + reranking actually wins on simple fact questions, while graph methods win on multi-hop and whole-corpus questions — so we layer them rather than replace one with the other.
  • Graph retrieval via Personalized-PageRank (the HippoRAG 2 approach). Chosen for the best accuracy-for-cost among graph methods and because it is designed for continual updates — documents can be added or changed without rebuilding the whole graph.
  • Graph stored in PostgreSQL (no separate graph database). Reuses existing infrastructure; a dedicated graph database is introduced only if heavier graph analytics later require it.
  • Entity & relationship extraction: a self-hosted LLM (Qwen) reads each document and builds the graph using a universal, domain-agnostic schema (a universal entity type plus an open subtype), so every document type — not just the ones loaded today — is covered without re-tuning.
  • Embeddings: bge-m3 today (multilingual, 1024-dimension); an upgrade to Qwen3-Embedding (top of the multilingual MTEB leaderboard) and AfriE5 for isiZulu/isiXhosa is planned for the next GPU expansion.
  • Reranking: bge-reranker-v2-m3 today (Apache-2.0, multilingual, fast); an upgrade to Qwen3-Reranker is planned for the next GPU expansion.

Your data stays separated. Every layer — search index, knowledge graph, communities and global summaries — is scoped to your organisation. Entities, relationships and whole-corpus summaries are never built or shared across organisations.

Rollout

The capability ships in stages, each useful on its own:

  • Phase 1 — Entities (rolling out now): recognise the key entities across every document, in any domain, using the universal schema.
  • Phase 2 — Relationships: connect them so multi-document, “how are these related” questions work.
  • Phase 3 — Communities & global summaries: whole-repository sense-making and portfolio-level questions.

Best Practices

Writing Effective Queries

Good Practices

  • ✓Be specific: "compliance documents from Q1 2024"
  • ✓Use natural language: "How many PDFs do I have?"
  • ✓Include context: "contracts mentioning data privacy"
  • ✓Ask one thing at a time for clarity

Avoid These

  • ✗Too vague: "show me stuff"
  • ✗Technical SQL syntax
  • ✗Multiple unrelated questions at once
  • ✗Expecting instant updates (indexes rebuild periodically)

Using Intelligent Mode

  • Keep it enabled for most use cases - it automatically optimizes performance
  • Disable it only if you want to force hybrid search for all queries
  • Monitor the indicator - you'll see which strategy was used after each query
  • Check browser console (F12) for technical details like execution time and method

Document Selection

  • No selection = searches your entire repository (collection-wide search)
  • Select specific documents = focuses search on those files only
  • Use with filters = narrow by date, type, or category before searching
  • Pro tip: For targeted questions, select documents first for faster, more focused results

Troubleshooting

Query returns no results

Possible causes:

  • No documents match your search criteria
  • Documents haven't been indexed yet (wait a few minutes after upload)
  • Document filters are too restrictive

Solution: Try a broader query like "all documents" to verify the system is working.

Slow query performance

Possible causes:

  • Complex analytical query with large aggregations
  • Analyzing many large documents
  • System under heavy load

Solution: Select specific documents to narrow scope, or split complex queries into smaller parts.

Results seem irrelevant

Possible causes:

  • Query is too broad or ambiguous
  • System found related but not exact matches
  • Document content doesn't match expectations

Solution: Be more specific, use exact phrases in quotes, or select specific documents.

Technical Details

Search Technologies:

  • • PostgreSQL Full-Text Search (BM25)
  • • Qdrant Vector Database (HNSW)
  • • BGE-M3 Embeddings
  • • Entity Knowledge Graph

Supported AI Models:

  • • Advanced AI (default)
  • • Premium models available
  • • Enterprise options
  • • Custom integrations