REQUEST A LIVE DEMO

Search Model

dragonGlass.SearchModel

Description:

Executes search using the dragonGlass.SearchEngine.

Constructor

    
new SearchModel(model)

Parameters:

Name Type
model object

Methods

    
(protected) normalizeData(raw) -> {object}

Flattens the data returned from Elastic and uses a customizer to adapt the data to match the needs of the view. Override this function to change the way the data is flattened. Create your own customizer to adapt the data to the view

Parameters:

Name Type Description
raw object the raw data from elasticsearch

Returns:

The transformed data


    
search() -> {deferred}

Parameters:

Name Type Description
query object the query object

Returns:

a deferred object

Example

    
search({ url:"/search/etc", data: { q:"politics" }, schema:"myschema" });

Fires:

event:dg-before-search
event:dg-results-loaded