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
| Written | Meaning | Parsed as |
|---|---|---|
report | A word | token |
"quarterly report" | An exact phrase | exact |
[knowledge management] | A concept — the terms treated as one unit | adjacent |
(a b) | A group | group |
/rep.*t/ | A regular expression | regex |
+term | Required | any, with op: "+" |
-term | Excluded | any, 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
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);import { ChangeDetectionStrategy, Component, computed, signal } from "@angular/core";
import { addConcepts, getConcepts, removeConcept } from "@sinequa/atomic";
@Component({
selector: "app-concept-chips",
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<input [value]="text()" (change)="text.set(value($event))" aria-label="Search" />
<!-- Chips derive from the text, so editing either stays consistent. -->
<ul>
@for (concept of concepts(); track concept) {
<li>
{{ concept }}
<button type="button" (click)="remove(concept)" [attr.aria-label]="'Remove ' + concept">×</button>
</li>
}
</ul>
`,
})
export class ConceptChipsComponent {
readonly text = signal('report +[knowledge management] "Q3 2024"');
readonly concepts = computed(() => getConcepts(this.text()));
add(concept: string) {
this.text.update((text) => addConcepts(text, [concept], "+"));
}
/** Removes only that concept; words, phrases and patterns are untouched. */
remove(concept: string) {
this.text.update((text) => removeConcept(concept, text));
}
value(event: Event) {
return (event.target as HTMLInputElement).value;
}
}import { addConcepts, getConcepts, removeConcept } from "@sinequa/atomic";
import { useMemo, useState } from "react";
export function ConceptChips() {
const [text, setText] = useState('report +[knowledge management] "Q3 2024"');
// Chips derive from the text, so editing either stays consistent.
const concepts = useMemo(() => getConcepts(text), [text]);
return (
<>
<input value={text} onChange={(event) => setText(event.target.value)} aria-label="Search" />
<ul>
{concepts.map((concept) => (
<li key={concept}>
{concept}
<button
type="button"
aria-label={`Remove ${concept}`}
/* Removes only that concept; words and phrases are untouched. */
onClick={() => setText(removeConcept(concept, text))}
>
×
</button>
</li>
))}
</ul>
<button type="button" onClick={() => setText(addConcepts(text, ["data governance"], "+"))}>
Add a concept
</button>
</>
);
}Influencing interpretation from the query
Three query properties change how the text is read, without changing the text itself:
| Property | Effect |
|---|---|
questionLanguage | The language the terms are interpreted in, overriding detection |
spellingCorrectionMode | Whether a correction is applied or merely suggested — what result.didYouMean reports |
neuralSearch | Turns 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.