Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
98739d7
Add new function to chunk strings
kderusso Sep 2, 2025
6ae1cdc
Refactor CHUNK function to support multiple values
kderusso Sep 8, 2025
1f4342c
Default to returning all chunks
kderusso Sep 8, 2025
528c12c
[CI] Auto commit changes from spotless
Sep 8, 2025
04307f2
Handle warnings
kderusso Sep 11, 2025
66a13bb
Loosen export restrictions to try to get compile error working
kderusso Sep 17, 2025
6b3191e
Merge main
kderusso Oct 13, 2025
693ea01
Remove inference dependencies
kderusso Oct 13, 2025
fde0368
Fix compilation errors
kderusso Oct 13, 2025
a70d5b1
Remove more inference deps
kderusso Oct 13, 2025
99894b4
Merge update from main
kderusso Oct 21, 2025
de9ddae
Fix compile errors from merge
kderusso Oct 21, 2025
d302fdd
Fix existing tests
kderusso Oct 21, 2025
ec456c6
Exclude from CSV tests
kderusso Oct 21, 2025
abeb725
Add more tests
kderusso Oct 21, 2025
46279f0
Cleanup
kderusso Oct 22, 2025
90deac7
[CI] Auto commit changes from spotless
Oct 22, 2025
7c78c32
Cleanup
kderusso Oct 22, 2025
9c9b373
Update docs/changelog/134320.yaml
kderusso Oct 22, 2025
db585e6
PR feedback
kderusso Oct 23, 2025
c7edb73
Remove null field constraint
kderusso Oct 23, 2025
c435bf4
[CI] Auto commit changes from spotless
Oct 23, 2025
84b8400
PR feedback: Refactor to use an options map
kderusso Oct 24, 2025
2ae2989
Cleanup
kderusso Oct 24, 2025
114c0da
Regenerate docs
kderusso Oct 24, 2025
45c517a
Add test on a concatenated field
kderusso Oct 24, 2025
7808118
Add multivalued field test
kderusso Oct 27, 2025
dafee14
Merge from main
kderusso Oct 27, 2025
f0a23f0
Don't hardcode strings
kderusso Oct 28, 2025
6a1da0e
[CI] Auto commit changes from spotless
Oct 28, 2025
ee4d532
PR feedback
kderusso Oct 29, 2025
b53b738
Merge from main
kderusso Oct 29, 2025
d12852c
[CI] Auto commit changes from spotless
Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/134320.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 134320
summary: Add CHUNK function
area: ES|QL
type: enhancement
issues: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
###############################################
# Tests for Chunk function
#

chunkExample
required_capability: chunk_function

// tag::chunk-with-field[]
FROM books
| EVAL chunks = CHUNK(description, 1, 20)
// end::chunk-with-field[]
| KEEP book_no, title, chunks
| SORT book_no
| LIMIT 5
;

// tag::chunk-with-field-result[]
book_no:keyword | title:text | chunks:keyword
1211 | The brothers Karamazov | In 1880 Dostoevsky completed The Brothers Karamazov, the literary effort for which he had been preparing all his life.
1463 | Realms of Tolkien: Images of Middle-earth | Twenty new and familiar Tolkien artists are represented in this fabulous volume, breathing an extraordinary variety of life into 58
1502 | Selected Passages from Correspondence with Friends | Nikolai Gogol wrote some letters to his friends, none of which were a nose of high rank.
1937 | The Best Short Stories of Dostoevsky (Modern Library) | This collection, unique to the Modern Library, gathers seven of Dostoevsky's key works and shows him to be equally adept
1985 | Brothers Karamazov | Four brothers reunite in their hometown in Russia.
// end::chunk-with-field-result[]
;

chunkDefaults
required_capability: chunk_function

FROM books
| EVAL chunks = CHUNK(description)
| KEEP book_no, title, chunks
| SORT book_no
| LIMIT 5
;

book_no:keyword | title:text | chunks:keyword
1211 | The brothers Karamazov | In 1880 Dostoevsky completed The Brothers Karamazov, the literary effort for which he had been preparing all his life. Compelling, profound, complex, it is the story of a patricide and of the four sons who each had a motive for murder: Dmitry, the sensualist, Ivan, the intellectual, Alyosha, the mystic, and twisted, cunning Smerdyakov, the bastard child. Frequently lurid, nightmarish, always brilliant, the novel plunges the reader into a sordid love triangle, a pathological obsession, and a gripping courtroom drama. But throughout the whole, Dostoevsky searhes for the truth--about man, about life, about the existence of God. A terrifying answer to man's eternal questions, this monumental work remains the crowning achievement of perhaps the finest novelist of all time. From the Paperback edition.
1463 | Realms of Tolkien: Images of Middle-earth | Twenty new and familiar Tolkien artists are represented in this fabulous volume, breathing an extraordinary variety of life into 58 different scenes, each of which is accompanied by appropriate passage from The Hobbit and The Lord of the Rings and The Silmarillion
1502 | Selected Passages from Correspondence with Friends | Nikolai Gogol wrote some letters to his friends, none of which were a nose of high rank. Many are reproduced here (the letters, not noses).
1937 | The Best Short Stories of Dostoevsky (Modern Library) | This collection, unique to the Modern Library, gathers seven of Dostoevsky's key works and shows him to be equally adept at the short story as with the novel. Exploring many of the same themes as in his longer works, these small masterpieces move from the tender and romantic White Nights, an archetypal nineteenth-century morality tale of pathos and loss, to the famous Notes from the Underground, a story of guilt, ineffectiveness, and uncompromising cynicism, and the first major work of existential literature. Among Dostoevsky's prototypical characters is Yemelyan in The Honest Thief, whose tragedy turns on an inability to resist crime. Presented in chronological order, in David Magarshack's celebrated translation, this is the definitive edition of Dostoevsky's best stories.
1985 | Brothers Karamazov | Four brothers reunite in their hometown in Russia. The murder of their father forces the brothers to question their beliefs about each other, religion, and morality.
;

chunkTextWithMatch
required_capability: chunk_function

FROM books
| WHERE MATCH(title, "Return")
| EVAL chunks = CHUNK(description, 1, 20)
| KEEP book_no, title, chunks;
ignoreOrder:true

book_no:keyword | title:text | chunks:keyword
2714 | Return of the King Being the Third Part of The Lord of the Rings | Concluding the story begun in The Hobbit, this is the final part of Tolkien s epic masterpiece, The Lord of
7350 | Return of the Shadow | In this sixth volume of The History of Middle-earth the story reaches The Lord of the Rings.
;

chunkTextWithMatchMultipleChunks
required_capability: chunk_function

FROM books
| WHERE MATCH(title, "Return")
| EVAL chunks = CHUNK(description, 3, 20)
| KEEP book_no, title, chunks;
ignoreOrder:true

book_no:keyword | title:text | chunks:keyword
2714 | Return of the King Being the Third Part of The Lord of the Rings | [Concluding the story begun in The Hobbit, this is the final part of Tolkien s epic masterpiece, The Lord of, part of Tolkien s epic masterpiece, The Lord of the Rings, featuring an exclusive cover image from the film, the, , featuring an exclusive cover image from the film, the definitive text, and a detailed map of Middle-earth.]
7350 | Return of the Shadow | [In this sixth volume of The History of Middle-earth the story reaches The Lord of the Rings., In The Return of the Shadow (an abandoned title for the first volume) Christopher Tolkien describes, with full citation of, first volume) Christopher Tolkien describes, with full citation of the earliest notes, outline plans, and narrative drafts, the intricate evolution]
;

chunkTextWithMatchMultipleChunksMvExpand
required_capability: chunk_function

FROM books
| WHERE MATCH(title, "Return")
| EVAL chunks = CHUNK(description, 3, 20)
| MV_EXPAND chunks
| KEEP book_no, title, chunks;
ignoreOrder:true

book_no:keyword | title:text | chunks:keyword
2714 | Return of the King Being the Third Part of The Lord of the Rings | , featuring an exclusive cover image from the film, the definitive text, and a detailed map of Middle-earth.
2714 | Return of the King Being the Third Part of The Lord of the Rings | Concluding the story begun in The Hobbit, this is the final part of Tolkien s epic masterpiece, The Lord of
2714 | Return of the King Being the Third Part of The Lord of the Rings | part of Tolkien s epic masterpiece, The Lord of the Rings, featuring an exclusive cover image from the film, the
7350 | Return of the Shadow | In The Return of the Shadow (an abandoned title for the first volume) Christopher Tolkien describes, with full citation of
7350 | Return of the Shadow | In this sixth volume of The History of Middle-earth the story reaches The Lord of the Rings.
7350 | Return of the Shadow | first volume) Christopher Tolkien describes, with full citation of the earliest notes, outline plans, and narrative drafts, the intricate evolution
;






Loading
Loading