Text Chunk
Fetch surrounding-context text chunks for a document's highlight locations, from the Sinequa backend.
TextChunkService retrieves text chunks — a highlight location plus a configurable number of sentences of
context on either side — for a given document. Used where a preview needs to show highlighted passages without
loading the whole converted document.
Minimal example
Fetching two chunks of context around a match
import { Component, inject } from "@angular/core";
import { TextChunkService } from "@sinequa/atomic-angular";
import type { Query } from "@sinequa/atomic";
@Component({
selector: "passage-context",
template: `<button (click)="load()">Load context</button>`,
})
export class PassageContextComponent {
private readonly textChunkService = inject(TextChunkService);
protected load() {
const query: Query = { name: "my-query", text: "quarterly report" };
this.textChunkService
.getTextChunks("doc-42", [{ offset: 0, length: 100 }], ["extractslocations", "matchlocations"], query, 2, 2)
.subscribe(chunks => console.log(chunks));
}
}Options
Prop
Type
getTextChunks(...) returns Observable<TextChunk[]>.
Pitfalls
What's next
Preview service
Fetch a document's preview data, drive its zoom and pagination, and toggle its highlights — the service every preview component delegates to.
SelectArticle
Select an article on click or Enter — replace it as the current selection, redirect to a preview route, or emit it — from a single directive.