new DetailedSearchModel()
addons/detailedSearch/model.js, line 84
Model for DetailedSearch
Fires:
- Addons.DetailedSearch#event:changedSearchFilters
Listens to Events:
- Addons#event:RadioRequestDetailedSearchGetGlyphIconsConfig
Extends
Methods
-
addSearchFilter(attr, val){void}
addons/detailedSearch/model.js, line 254 -
Adds a single filter.
Name Type Description attr
String The key of the attribute to filter val
String The value of the attribue to filter -
applySearchFilter(attr, val, add){void}
addons/detailedSearch/model.js, line 239 -
Adds/removes a single filter to existing ones and calls the search afterwards.
Name Type Description attr
String The key fo the attribute to filter val
String The value of the attribute to filter add
Boolean Handler, if the filter should be added or removed -
buildCategoriesQuery(){String}
addons/detailedSearch/model.js, line 553 -
Builds the categories query.
Returns:
categories query
-
buildRecommendedSearchQuery(){String}
addons/detailedSearch/model.js, line 532 -
Builds the recommended search query.
Returns:
search query
-
buildSearchQuery(){String}
addons/detailedSearch/model.js, line 468 -
Builds the search query.
Returns:
search query
-
changeLang(lng){Void}
addons/detailedSearch/model.js, line 771 -
change language - sets default values for the language
Name Type Description lng
String the language changed to -
changeSearchApiLang(){Void}
addons/detailedSearch/model.js, line 797 -
Handles search API related changes due to language change: - Reload the categories with new lang code - Restore a possibily set category so the UI gets translated - Trigger a possible search with new lang code
-
cleanEpsg(epsg){String}
addons/detailedSearch/model.js, line 131 -
Prepend the "epsg:" prefix to an epsg code if not set.
Name Type Description epsg
String the epsg string to clean Returns:
cleaned epsg string
-
clearSearch(){void}
addons/detailedSearch/model.js, line 305 -
Clears the search by resetting all relevant properties.
-
fillDefaultGlyphIcon(glyphIcons){Object}
addons/detailedSearch/model.js, line 696 -
Adds the glyphIcons.categories.default property with the default icon name, if it was not set already. Specifically checks for undefined, as empty strings are allowed values.
Name Type Description glyphIcons
Object The glyphIcons object Returns:
filled glyphIcons object
-
fillEmptyGlyphIcons(glyphIcons){Object}
addons/detailedSearch/model.js, line 725 -
Fills undefined values with default icon names. Specifically checks for undefined, as empty strings are allowed values.
Name Type Description glyphIcons
Object The glyphIcons object Returns:
filled glyphIcons object
-
getCurrentBbox(){String}
addons/detailedSearch/model.js, line 564 -
Get the bbox of the current map state
Returns:
bbox as String coordinates
-
getGlyphIconsConfig(){Object}
addons/detailedSearch/model.js, line 647 -
Returns the glyphIcons config
Returns:
glyphIcons config object
-
getRecommendedResults(){Backbone.Collection}
addons/detailedSearch/model.js, line 603 -
Getter for recommendedResults
Returns:
recommendedResults collection
-
getSearchLimit(){Integer}
addons/detailedSearch/model.js, line 615 -
Returns the default number of search results
Returns:
of search results
-
getSearchResults(){Backbone.Collection}
addons/detailedSearch/model.js, line 587 -
Getter for searchResults
Returns:
searchResults collection
-
getSearchStats(){Backbone.Collection}
addons/detailedSearch/model.js, line 595 -
Getter for searchStats
Returns:
searchStats collection
-
mergeCategories(categories){Array.<CategoryFilterModel>}
addons/detailedSearch/model.js, line 401 -
Merges the categories between those supported by the backend and those listed in the configuration. If no categories were specified in the configuration, all categories supported by the backend will be added. Categories can be disabled by setting an empty list in the configuration.
Name Type Description categories
Array.<Object> the categories supported by the backend Returns:
of merged CategoryFilterModels
-
removeSearchFilter(attr, val){void}
addons/detailedSearch/model.js, line 280 -
Removes a single value from a filter. If a filter only contains one value, the entire filter will be removed.
Name Type Description attr
String The key of the attribute of which the filter should be removed val
String The value of the attribue of which the filter should be removed -
resetSearchMeta(options){void}
addons/detailedSearch/model.js, line 628 -
Resets the searchMeta attribute to its default values
Name Type Description options
Object Backbone setter options -
search(){void}
addons/detailedSearch/model.js, line 162 -
Calls the search api and handles the response.
-
searchRecommended(){void}
addons/detailedSearch/model.js, line 208 -
Fires the recommended search and updates the recommendedResults collection accordingly
-
setNextPage(){void}
addons/detailedSearch/model.js, line 655 -
Sets the properties to get the next page of search results
-
setPreSearchString(val){void}
addons/detailedSearch/model.js, line 331 -
Sets the pre search string
Name Type Description val
String The new value of the preSearchString -
setPreviousPage(){void}
addons/detailedSearch/model.js, line 667 -
Sets the properties to get the previous page of search results
-
setSearchString(val){void}
addons/detailedSearch/model.js, line 322 -
Sets the search string
Name Type Description val
String The new value of the searchString -
shouldTriggerRecommended(){Boolean}
addons/detailedSearch/model.js, line 435 -
Checks if the recommended search should be triggered, depending on the number of input chars.
Returns:
if search should be triggered, false otherwise
-
shouldTriggerSearch(){Boolean}
addons/detailedSearch/model.js, line 458 -
Checks if the search should be triggered, depending on the number of input chars.
Returns:
if search should be triggered, false otherwise