
WordsSearch.result( type as string ) as Iterable
Executes the words search definition and returns an array or object depending on whether the results are generated by default, with a mapper, or with a reducer.
| Parameters | |
|---|---|
| type | Specifies 'value' (the default) to return the words as a value (an array unless reducing) or 'iterator' to return a streaming iterator over the words. |
// Find the first 10 words that occur in the "title" property of
// documents containing the word "adventure".
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.words(srch.jsonPropertyLexicon('title'))
.where(cts.wordQuery('adventure'))
.slice(0, 10)
.result();
// Result: An array of the matched words.