ioredisearch
Version:
Client library for RediSearch Redis Module, designed to work in conjunction with ioredis
92 lines (91 loc) • 2.7 kB
TypeScript
import { Filter } from './filter';
export declare class Query {
_noContent: boolean;
_withPayloads: boolean;
private _queryString;
private _offset;
private _num;
private _noStopwords;
private _fields;
private _verbatim;
private _filters;
private _ids;
private _slop;
private _inOrder;
private _sortby;
private _returnFields;
constructor(queryString: string);
/**
* Return the query string of this query only
*/
readonly queryString: string;
/**
* Limit the results to a specific set
* of pre-known document ids of any length
*/
limitIds(ids: string[]): this;
/**
* Only return values from these fields
*/
returnFields(fields: string[]): this;
/**
* Allow a maximum of N intervening
* non matched terms between phrase terms
* (0 means exact phrase)
*/
slop(slop: number): this;
/**
* Set the paging for the query (defaults to 0..10).
* @param offset Paging offset for the results. Defaults to 0
* @param num How many results do we want
*/
paging(offset: number, num: number): this;
/**
* Set the query to be verbatim,
* i.e. use no query expansion or stemming
*/
verbatim(): this;
/**
* Set the query to only return ids and not the document content
*/
noContent(): this;
/**
* Prevent the query from being filtered for stopwords.
* Only useful in very big queries
* that you are certain contain no stopwords.
*/
noStopwords(): this;
/**
* Ask the engine to return document payloads
*/
withPayload(): this;
/**
* Limit the search to specific TEXT fields only
* @param fields A list of strings, case sensitive field names from the defined schema
*/
limitFields(fields: string[]): this;
/**
* Add a numeric or geo filter to the query.
* **Currently only one of each filter is supported by the engine**
* @param Filter A NumericFilter or GeoFilter object, used on a corresponding field
*/
addFilter(filter: Filter): this;
/**
* Add a sortby field to the query
* @param field the name of the field to sort by
* @param asc when `true`, sorting will be done in ascending order
*/
sortBy(field: string, asc?: boolean): this;
/**
* Match only documents where the query terms
* appear in the same order in the document.
* i.e. for the query 'hello world',
* we do not match 'world hello'
*/
inOrder(): this;
/**
* Format the redis arguments
* for this query and return them
*/
readonly args: (string | number)[];
}