> ## Documentation Index
> Fetch the complete documentation index at: https://help.casaconect.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> How Casa Conect makes your documents searchable, for you and for the agent, in Spanish and English, without ever searching outside what you are allowed to see.

When you ask the agent a question about your files, it does not read every document. It **searches**, retrieves the few passages that matter, and works from those. The quality of that search decides the quality of the answer, so it is built with some care.

## From upload to searchable

<Steps>
  <Step title="Queued">
    Every document that enters Casa Conect is queued for indexing, whether it was uploaded, filed from email, synced from a drive or added to a Shared Space. A document that is being edited continuously is indexed once the edits settle: about two minutes after the last change, and at least every ten minutes while editing continues.
  </Step>

  <Step title="Scanned">
    The file's malware scan must come back clean before it is read.
  </Step>

  <Step title="Parsed">
    Text, tables and layout are extracted, including from scanned pages. If the first pass produces a low-confidence reading, typical of a poor scan, the document is automatically re-read with a more capable parser.
  </Step>

  <Step title="Divided into passages">
    The document is split along its **own structure**. Headings, tables, lists and figures are natural boundaries, and each passage remembers the heading it sits under. Long text is divided at sentence boundaries by a splitter that understands Spanish legal writing. Abbreviations such as *S.L.*, *N.I.E.*, *D.N.I.* and *C.I.F.*, and ordinals such as *1.º* and *2.ª*, do not break a sentence in two.
  </Step>

  <Step title="Indexed twice">
    Each passage is indexed for **meaning**, as a vector embedding, and for **words**, as a full-text index. Its language is detected so that the right linguistic rules apply.
  </Step>
</Steps>

Most documents are searchable within a few minutes. Large scans take longer. Until then the agent may tell you that a document is not indexed yet, and [Populate](/workflows/populate) waits for indexing at its *Waiting for sources* stage.

## How a search works

<AccordionGroup>
  <Accordion title="1. Access first" icon="key-round">
    Before anything is searched, Casa Conect works out **exactly which documents you may read** from your vaults, your projects and your permissions in each Shared Space. The search runs only inside that set. A narrower filter can reduce it, never widen it.
  </Accordion>

  <Accordion title="2. Understanding the query" icon="text-search">
    Your question is reduced to the terms that matter: names, identifiers such as a NIE or a cadastral reference, amounts and key words. Filler words are dropped. If this step fails, your question is used as it was written.
  </Accordion>

  <Accordion title="3. Two searches at once" icon="split">
    A **semantic** search finds passages that *mean* something similar, even in different words. A **keyword** search finds exact terms, which matters enormously for names, numbers and references that a meaning-based search handles poorly.
  </Accordion>

  <Accordion title="4. Fusion" icon="merge">
    The two result lists are merged in a way that rewards passages both searches agree on, and a shortlist of candidates goes forward.
  </Accordion>

  <Accordion title="5. Reranking" icon="arrow-down-wide-narrow">
    A dedicated reranking model reads each candidate against your question and reorders them. The best few are returned.
  </Accordion>
</AccordionGroup>

## Spanish and English

Search is bilingual by design.

* Each passage is tagged as Spanish or English, defaulting to **Spanish** when in doubt.
* Keyword search uses the right **stemming** for each language, so *arrendamiento* finds *arrendamientos*. It also ignores accents, so *hipoteca* finds *hipotéca* as typed by a hurried colleague.
* Every query is run against **both** languages, and the better match wins. A Spanish question therefore finds an English contract, and the reverse.
* Spanish identifiers such as `Y-7654321-K` and `44.567.891-K` are kept intact instead of being split at their punctuation.

## What the agent sees, and what you see

A search returns **excerpts**, each with its section title, the document it came from, its scope and a relevance score. The agent then opens the documents it needs in full. In the conversation, a search appears as *"Searched your documents"* with the query it used.

Elsewhere in the product, values extracted from documents carry **citations**:

* In a Shared Space **Summary**, each AI-confirmed value has a numbered citation. It opens a preview of the source with the relevant passage highlighted, and an **Open in file viewer** button.
* In the **editor**, values placed by [Populate](/workflows/populate) carry a source marker showing which vault the source is in, and the excerpt.

If a citation points to a document you are not allowed to read, you are told that a source exists, but you cannot see its contents.

## Getting better results

| Do                                                     | Because                                            |
| :----------------------------------------------------- | :------------------------------------------------- |
| Use the exact name, number or reference if you know it | Keyword search is precise for identifiers          |
| Describe what you mean if you do not                   | Semantic search finds passages in other words      |
| Work **inside the project** the documents belong to    | The agent searches the relevant vault first        |
| Upload readable scans: 300 dpi, straight, complete     | Text extraction can only be as good as the image   |
| Give documents meaningful names                        | Names help you and the agent to recognize a source |

## What is searched

| Scope                  | Included                                                                                                                               |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
| Your private vault     | Yes. Only for you.                                                                                                                     |
| Organization vault     | Yes                                                                                                                                    |
| Project vaults         | Yes, for projects you can see                                                                                                          |
| Shared Space documents | Yes, subject to your permissions on each document type                                                                                 |
| Email bodies           | Not through document search. The agent reads conversations with its email tools. Attachments are searchable once they have been filed. |

Deleting a document removes it from the index.

## Services involved

Parsing, embedding, query understanding and reranking are performed by specialist services, listed with exactly what each receives under [AI data handling](/security/ai-data-handling#supporting-services). The index itself, both passages and vectors, is stored in Casa Conect's own database in the EU.
