Documents and AI

How search finds the right document

Search runs two searches at once (one by meaning, one by the words themselves, weighted by how rare each is in your documents) and merges them into one list of documents. Each result shows what it matched, so a surprising one explains itself.

ABOUT 8 MINUTESEXPLAINERFOR EVERYONEGETTING STARTED · STEP 5 OF 7

Logley principleA result explains its own match

Each result shows the words it contains and the passage that matched, so you can judge it for yourself rather than trust a score.

Goal

Run one search and read, on each result, why it was found.

  1. Start from any page

    Most pages, including the Dashboard, Documents and Invoices, have a search field at the top, and Ctrl K (⌘K on a Mac) puts the cursor in it. Type your query and press Enter: you arrive on the Semantic Search page with the search already run. On a few list pages, Shipments among them, that field filters the list instead.

    The search field at the top of the page. Ctrl K puts the cursor in it.
  2. Refine it there

    Change the query and choose Explore to run it again. Filter by Category limits the search to one document type.

  3. Read the results

    You get up to ten results, one per document, best first. Each card carries the evidence for its place in the list.

What each search result shows
On the cardWhat it tells you
File name and typeThe document, linked to its page in Logley.
Match: 87%Its score, explained below — how well it matched your query, not whether it answers your question.
The quoted passageIts best-matching passage, with your words highlighted.
Matched 4 of 4 terms:Which of your words were found in it, one chip each.
Page 1, +2 more matching sectionsWhere the passage is, and how many other passages of the same document matched by meaning.
Open FileThe document’s page: the original, the values read from it, and its text.

Two searches at once

Every query runs two searches side by side on your own server. Neither needs the internet.

By meaning
  • Each document’s text is cut into passages of about 1,500 characters, page by page, overlapping slightly.
  • A local embedding model, nomic-embed-text, turns each passage (and your query) into 768 numbers describing what it is about. They are kept in the Qdrant vector store, in the document_chunks collection.
  • Search takes the passages whose numbers lie closest to your query’s, by cosine similarity. That is how “truck transit fee” can find a toll invoice that shares none of those words.
By words
  • A PostgreSQL full-text index of each document’s text, file name, supplier, route, tags and notes.
  • Case and accents are ignored on both sides: “gdansk” finds “Gdańsk”, “lodz” finds “Łódź”.
  • Each word also matches longer words that begin with it: “dostaw” finds “dostawy”.
  • An amount matches however it is written: 1845, 1 845.00, 1,845.00 and 1.845,00 are the same amount.
  • A misspelt word of four letters or more can still match a close file name, supplier, route or tag.
  • Small words such as “for”, “the”, “dla” and “und” are left out, and up to twelve words count.

Why run both? The two fail in opposite ways. Meaning finds a document written in other words but blurs exact names and numbers; words find the exact name but miss a paraphrase. If the embedding model is unavailable, Search still answers from the words, and if the word index fails, from meaning alone.

One detail matters for quality: before the model reads them, Logley labels your query as a search query and each passage as a document to be found — the instructions nomic-embed-text was trained with. Without them, the meaning search drifts towards simply matching the same words.

How the two become one list

Results are ranked per document, not per passage: ten results are ten documents, each shown with its best passage. A document’s Match is its score out of 100, in three parts:

Meaning · 55%How close the document’s best passage is to your query. The scale starts where passages stop being unrelated, so the faint likeness every text has to every query counts for nothing.
Words · 45%The share of your words the document contains, each weighted by how rare it is in your organization’s documents.
Document type · +8 pointsYour query names a type (“invoice”, “faktura”, “CMR”, “umowa”) and the document is of that type.
The two parts to scale. The type bonus is added on top, only when the query names a type and the document is one.

The rarity weighting is what makes words count. In a collection that is mostly invoices, “invoice” is in nearly every document, so containing it adds almost nothing; “Gdańsk” is in a few, so containing it adds a great deal. The weights are worked out from your own documents each time you search, so the same query can rank differently in another organization.

Two rules keep the list honest. A type word only boosts: a CMR that quotes an invoice number can still appear in a search for invoices; choose a category when you want other types removed. And a document containing none of your words has to earn its place on meaning alone. Below a minimum score it is dropped rather than shown, because a fragment with almost no text (a logo, a stamp) sits close to almost any query, and an empty result is more honest than a page of those.

Reading a surprising result

The card tells you why a document was found; read it before you trust the order. In the screenshot above, the top result contains all four words and scores 87%, but its Gdańsk is the supplier’s address, and the goods were loaded in Warszawa. The second result, at 82%, is the one loaded in Gdańsk; its text reads “Gdansk”, without the accent, and still matched. Word matching counts whether your words are in a document, not the part they play in it, and two invoices laid out alike are close in meaning too. The highlighted passage is where you see the difference.

  • A high Match with few of your words: it was found by meaning — it is about your query in other words.
  • All your words, a lower Match: the words are there, but its best passage is about something else.
  • A word missing from the chips: it is one of the small words search leaves out.
  • A document of another type: it matched your words; a type word in the query boosts, it never filters.

Queries that find things

  • Lead with what is distinctive. A name, a place or a reference number carries the weight because it is rare in your documents; “invoice” or “transport” adds little in a collection full of them. “Show”, “find”, “all” and “my”, and their Polish equivalents, are dropped anyway.
  • Name the type to prefer it, filter to insist on it. “faktura Gdańsk” ranks invoices first; Filter by Category removes everything else.
  • Type the shared beginning of a word. Words are not reduced to a dictionary form, because the index holds Polish, English and German alike. “faktur” matches faktura, faktury and fakturze by its letters; “faktura” matches only the first.

When the index is rebuilt

Each document records which embedding format its passages were built with. When a Logley release changes that format (the labels, the passage size or the model), a job that runs each time the server starts re-embeds the documents built the old way, one at a time; if it is interrupted, it carries on at the next start. Until a document has been re-embedded, it is still found by its words, and less well by meaning.

Leave the embedding model as it is

The format is set by Logley, not by configuration. Pointing Ollama:EmbeddingModel at another model re-embeds nothing, and the index expects 768 numbers per passage — so on an installation that already holds documents it stays nomic-embed-text.

Limits

  • It matches the text as it was read. A poor scan limits both searches: the second result above has “Miinchen” in its text, a misreading of München.
  • A new document is found in two stages. By its words once its text has been read, and by meaning only once processing has embedded it — the last step. What happens to a document describes each stage.
  • Ten results, no date filter. The page shows the ten best documents and has no date range; narrow it with a category or a more distinctive word. A query can be up to 2,000 characters.
  • Your organization, minus private documents. Results never include another organization’s documents. Inside yours, everyone who can search sees every document except other people’s private ones, which only their uploader and Admins see; there is no other per-person filtering.
  • The assistant searches the same way. Chat finds document passages with the same two-part search as this page, meaning and words together, so an exact reference or a rare name works there too. Asking Logley a question covers phrasing for the assistant.
GETTING STARTED · NEXT STEP 6 OF 7Ask AI
Continue

Continue exploring

Was this guide useful?

If something was missing or unclear, the contact page says where to write.

Contact