Documentation Index
Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
Use this file to discover all available pages before exploring further.
Description
Twigkit service for queries
Methods
clearQueries()
Will remove all the queries from the factory.
Example
QueryService.clearQueries();
convertHttpParamsToQuery(httpParams)
Converts http params to query value..
Parameters
| Param | Type | Details |
|---|
| httpParams | object | The httpParams of the query. |
Example
QueryService.convertHttpParamsToQuery(value);
convertHttpParamsToUrl(httpParams)
Converts http params into a URL.
Parameters
| Param | Type | Details |
|---|
| httpParams | object | A query object as http params |
Example
QueryService.convertHttpParamsToUrl(query, true);
convertQueryToHttpParams(query, excludeHiddenFilters)
Converts an object based query to HTTP Params.
Parameters
| Param | Type | Details |
|---|
| query | object | Query to convert |
| excludeHiddenFilters (optional) | boolean | Whether to include hidden filters in the params. |
Returns
| |
|---|
| object | Returns the query object as http params. |
Example
QueryService.convertQueryToHttpParams(query);
convertQueryToUrl(query, includeHiddenFilters)
Converts query object into a URL, encoding necessary values correctly and optionally removing hidden filters
Parameters
| Param | Type | Details |
|---|
| query | object | The query object. |
| includeHiddenFilters | boolean | Whether to include hidden filters in the URL |
Example
QueryService.convertQueryToUrl(query, true);
convertSortObjectToParam()
Will convert sort object into a parameter.
Example
QueryService.convertSortObjectToParam(obj);
convertSortParamToObject()
Will convert sort parameter into an object.
Example
QueryService.convertSortParamToObject(param);
getQuery(name)
Gets the value of the query from the factory. If no query is found, the factory will return null.
Parameters
| Param | Type | Details |
|---|
| name | string | Name of the query to retrieve. |
Returns
| |
|---|
| object | Returns the query object, if no query object exists it will return null. |
Example
QueryService.getQuery(name);
getQueryAsHttpParams(name, excludeHiddenFilters)
Gets the value of the query from the factory. If no query is found, the factory will return null.
Parameters
| Param | Type | Details |
|---|
| name | string | Name of the query to retrieve. |
| excludeHiddenFilters (optional) | boolean | Whether to include hidden filters in the params. |
Returns
| |
|---|
| object | Returns the query object, if no query object exists it will return null. |
Example
QueryService.getQueryAsHttpParams(name);
queryContainsFilterForField(query, fieldName, filter)
Will identify if the query contains the filter.
Parameters
| Param | Type | Details |
|---|
| query | object | The query object. |
| fieldName | string | The name of the field |
| filter | object | The filter object |
Example
QueryService.queryContainsFilterForField(query, fieldName, filter);
removeFiltersForField(query, fieldName)
Will remove any filters relating to the field name
Parameters
| Param | Type | Details |
|---|
| query | object | The query object. |
| fieldName | string | The name of the field |
Example
QueryService.removeFiltersForField(query, fieldName);
setQuery(name, value)
Adds the query value to the factory.
Parameters
| Param | Type | Details |
|---|
| name | string | Name to store the query under. |
| value | object | The value of the query. |
Example
QueryService.setQuery(name,value);
Events
query_name_updated
When the query is set or changed Lightning will broadcast this message where name is the name of your query query_name_updated
Type:
broadcast
Target:
root scope