DocLayer comes with a built-in search functionality powered by the dl-search module. The Search component, which is mounted by default in the Header as soon as you begin working with DocLayer, utilizes this module. While the Search component provides the user interface for searching, the dl-search module manages all underlying search logic and operations.
The search functionality is divided into two main capabilities:
- Static search: traditional search functionality powered by the Fuse.js library, where you can search for any content statically.
- AI-powered search: Advanced search built as a RAG technology, which can operate entirely locally or utilize remote LLMs (typically via a third-party provider's API). This feature requires a dedicated preparation process and can be enabled/disabled if needed.
How it works
Below you’ll find an overview of the search functionality flow. On the next pages, you can explore how to configure and use the search engine to best suit your needs.
Indexing the content
The first and most important step is the content indexing. Any selected content collection - by default docs - will be scanned, parsed, and indexed into a searchable format. This index is then saved in the public directory to be accessible by the search engine, used both for static and AI-powered search.
Static search
As mentioned earlier, static search is powered by Fuse.js. It uses the indexed content to perform searches based on the user’s query; results are then displayed in a search modal. This approach is extremely fast, though it works essentially like an anchor-based list and does not provide any additional contextual information.
AI Assistant assembling
This step applies only if AI-powered search is enabled.
The AI Assistant can operate entirely locally, within the user's browser context, without any additional dependencies like MCP servers. But what does this actually mean? In addition to the standard content index, the dl-search module generates a vector-based representation of that content. To accomplish this, the module (during the runtime) uses a lightweight text embedding model. The resulting vector database is then integrated into the application.
Performing the assistive search
The purpose of building a vector representation is to enable highly accurate retrieval of relevant content for the AI model. This allows the model to answer any user question about your content by focusing only on the most contextually relevant information, rather than processing the entire content set. As a result, responses are faster, more efficient, and cost-effective.
For the resolution of user prompts, you can choose one of two paths:
- Local - Handled by a compact yet powerful model (of the
feature-extractiontype) that the user downloads during the dedicated preparation process. The model is then cached (working offline) in the browser and used each time to resolve prompts. This approach can be highly efficient for simple, content-driven contexts (like blogs), where information is easy to extract and distill. - Remote - Managed by a remote model accessible via API. You can use custom or our pre-built interface, which offers dedicated LLM resolving with secure prompting, context focusing, and deterministic cache, delivering an consistent, high-quality assistant experience for all users - ready to use from day one - available with the 🫠 Early Supporter Program.
