Loading TOC...

MarkLogic 9 Product Documentation
jsearch functions (jsearch)

This class contains the top level entry points into the JSearch API, plus helper functions for constructing some of the more complex inputs expected by the interfaces.

To use this module in your Server-Side JavaScript code, include a require statement similar to following line in your code:

const jsearch = require("/MarkLogic/jsearch");
   

Use the following methods to begin building a query on documents, index or lexicon values, or value co-occurrences:

If you're working primarily with documents in one or more collections, you can use jsearch.collections to create a jsearch object implicitly scoped to those collecitons.

You can use jsearch.documentSelect to leverage JSearch features such as snippeting and content extraction to an arbitrary set of documents.

The remaining jsearch methods are helper functions for constructing non-trivial inputs to other methods, such as lexicon references and heat maps.

The following classes are also part of the JSearch API. You usually end up working with these interfaces by starting with a call to a jsearch method. For example, if you invoke jsearch.documents, you end up working with the DocumentsSearch interface.

18 functions
Function name Description
jsearch.bucketName Names a bucket below the smallest bound, between two bounds, or above the largest bound as input for the ValuesSearch.groupInto or FacetDefinition.groupInto method.
jsearch.byExample Constructs a cts.query working by example.
jsearch.collections Creates a jsearch object for searching within the scope of the union of one or more collections.
jsearch.databaseLexicon Identifies the lexicon for all words in the database as input for the jsearch.words method.
jsearch.documents Creates a DocumentsSearch object to define and execute a search for documents.
jsearch.documentSelect Applies document selection logic to the documents returned by cts.search, fn.collection, fn.doc, or another document iterator or to an array of documents or one document.
jsearch.elementAttributeLexicon Identifies the word lexicon for an attribute of an element as input for the jsearch.words method.
jsearch.elementLexicon Identifies the word lexicon for an element as input for the jsearch.words method.
jsearch.facet Creates a FacetDefinition object to define the value enumeration as part of a facet search.
jsearch.facets Creates a FacetsSearch object to define and execute a report listing value facets and, optionally, a page of documents.
jsearch.fieldLexicon Identifies the word lexicon for a field as input for the jsearch.words method.
jsearch.jsonPropertyLexicon Identifies the word lexicon for a JSON property as input for the jsearch.words method.
jsearch.makeBuckets Returns a list of bounds for grouping by subdividing an interval either with a fixed step size or a fixed number of division buckets within the min and max boundary values as input for the ValuesSearch.groupInto or FacetDefinition.groupInto method.
jsearch.makeHeatmap Returns a list of bounds for grouping geospatial points as a heatmap by subdividing a geospatial box with latitude and longitude divisions as input for the ValuesSearch.groupInto or FacetDefinition.groupInto method.
jsearch.tuples Creates a TuplesSearch object to define and execute a search for a list of rows where the values in each row co-occur in indexes for a document.
jsearch.udf Identifies a UDF (User Defined Function) to the ValuesSearch.aggregate function for aggregating values from a single index or to the TuplesSearch.aggregate function for aggregating co-occurring values from multiple indexes.
jsearch.values Creates a ValuesSearch object to define and execute a search for a list of indexed values.
jsearch.words Creates a WordsSearch object to define and execute a search for a list of indexed words.