@sinequa/atomic

Query syntax

What a user can type in the search box — exact phrases, concepts, exclusions — and the helpers that manipulate it as data.

The text of a query is not just words. Sinequa reads a small syntax in it, and a search interface usually has to build and edit that syntax rather than let the user type it by hand.

The syntax

WrittenMeaningParsed as
reportA wordtoken
"quarterly report"An exact phraseexact
[knowledge management]A concept — the terms treated as one unitadjacent
(a b)A groupgroup
/rep.*t/A regular expressionregex
+termRequiredany, with op: "+"
-termExcludedany, with op: "-"

Concept — a concept

Square brackets mark a concept: a multi-word expression the engine treats as a single searchable unit rather than as separate words. Interfaces usually surface them as removable chips next to the search box.

Editing concepts as data

Rather than manipulating the string with regular expressions, four helpers read and write it:

Prop

Type

A search box with concept chips
src/concept-chips.ts
import { addConcepts, createAtomicClient, getConcepts, removeConcept } from "@sinequa/atomic";

const client = createAtomicClient({
  app: "<your-app>",
  backendUrl: "https://<your-sinequa-server>",
});

await client.initializeConfig();
await client.auth.login();

let text = 'report +[knowledge management] "Q3 2024"';

// Chips to render, without touching the rest of the text.
console.log(getConcepts(text)); // ["knowledge management"]

// The user adds one.
text = addConcepts(text, ["data governance"], "+");
console.log(text); // report +[knowledge management] "Q3 2024" +[data governance]

// The user removes a chip — the phrase and the plain word survive.
text = removeConcept("knowledge management", text);
console.log(text); // report "Q3 2024" +[data governance]

const result = await client.api.query.search({ name: "<your-query>", text, pageSize: 10 });
console.log(result.rowCount);

Influencing interpretation from the query

Three query properties change how the text is read, without changing the text itself:

PropertyEffect
questionLanguageThe language the terms are interpreted in, overriding detection
spellingCorrectionModeWhether a correction is applied or merely suggested — what result.didYouMean reports
neuralSearchTurns vector retrieval off, leaving keyword matching only

The query web service also carries a configured precision and strategy (questionPrecision, questionStrategy), which is why an identical text can behave differently across two services. See Server configuration.

Pitfalls

What's next

On this page