new DetailedSearchModel()
addons/detailedSearch/model.js, line 83
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 246 -
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 231 -
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 545 -
Builds the categories query.
Returns:
categories query
-
buildRecommendedSearchQuery(){String}
addons/detailedSearch/model.js, line 524 -
Builds the recommended search query.
Returns:
search query
-
buildSearchQuery(){String}
addons/detailedSearch/model.js, line 460 -
Builds the search query.
Returns:
search query
-
changeLang(lng){Void}
addons/detailedSearch/model.js, line 763 -
change language - sets default values for the language
Name Type Description lng
String the language changed to -
changeSearchApiLang(){Void}
addons/detailedSearch/model.js, line 789 -
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 130 -
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 297 -
Clears the search by resetting all relevant properties.
-
fillDefaultGlyphIcon(glyphIcons){Object}
addons/detailedSearch/model.js, line 688 -
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 717 -
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 556 -
Get the bbox of the current map state
Returns:
bbox as String coordinates
-
getGlyphIconsConfig(){Object}
addons/detailedSearch/model.js, line 639 -
Returns the glyphIcons config
Returns:
glyphIcons config object
-
getRecommendedResults(){Backbone.Collection}
addons/detailedSearch/model.js, line 595 -
Getter for recommendedResults
Returns:
recommendedResults collection
-
getSearchLimit(){Integer}
addons/detailedSearch/model.js, line 607 -
Returns the default number of search results
Returns:
of search results
-
getSearchResults(){Backbone.Collection}
addons/detailedSearch/model.js, line 579 -
Getter for searchResults
Returns:
searchResults collection
-
getSearchStats(){Backbone.Collection}
addons/detailedSearch/model.js, line 587 -
Getter for searchStats
Returns:
searchStats collection
-
mergeCategories(categories){Array.<CategoryFilterModel>}
addons/detailedSearch/model.js, line 393 -
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 272 -
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 620 -
Resets the searchMeta attribute to its default values
Name Type Description options
Object Backbone setter options -
search(){void}
addons/detailedSearch/model.js, line 161 -
Calls the search api and handles the response.
-
searchRecommended(){void}
addons/detailedSearch/model.js, line 202 -
Fires the recommended search and updates the recommendedResults collection accordingly
-
setNextPage(){void}
addons/detailedSearch/model.js, line 647 -
Sets the properties to get the next page of search results
-
setPreSearchString(val){void}
addons/detailedSearch/model.js, line 323 -
Sets the pre search string
Name Type Description val
String The new value of the preSearchString -
setPreviousPage(){void}
addons/detailedSearch/model.js, line 659 -
Sets the properties to get the previous page of search results
-
setSearchString(val){void}
addons/detailedSearch/model.js, line 314 -
Sets the search string
Name Type Description val
String The new value of the searchString -
shouldTriggerRecommended(){Boolean}
addons/detailedSearch/model.js, line 427 -
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 450 -
Checks if the search should be triggered, depending on the number of input chars.
Returns:
if search should be triggered, false otherwise