Class: SearchbarModel

Searchbar SearchbarModel

SearchbarModel

new SearchbarModel(){void}

modules/searchbar/model.js, line 56
todo
Properties:
Name Type Default Description
placeholder String "" todo
recommendedList String "" todo
recommendedListLength Number 5 todo
quickHelp Boolean false todo
searchString String "" the current string in the search mask
hitList Array [ todo
minChars String "" todo
isInitialSearch Boolean true Flag that is set to false at the end of the initial search (ParametricURL).
isInitialRecommendedListCreated Boolean false Has the recommended list already been generated after the initial search?
knownInitialSearchTasks Array.<String> ["gazetteer", "specialWFS", "bkg", "tree", "osm"] Search algorithms for which an initial search is possible
activeInitialSearchTasks Array [ Search algorithms for which an initial search is activated
i18nextTranslate function null translation function named i18nextTranslate := function(setter), set during parsing the file "config.json"
buttonSearchTitle String "", filled with "Suchen"- translated
buttonOpenHelpTitle String "", filled with "Hilfe öffnen"- translated
showAllResultsText String "", filled with "alle Ergebnisse anzeigen"- translated
Fires:
  • ParametricURL#event:RadioRequestParametricURLGetInitString
  • Searchbar#event:RadioTriggerSearchbarSetPastedHouseNumber
  • Searchbar#event:RadioTriggerSearchbarSearch
  • ViewZoom#event:RadioTriggerViewZoomHitSelected
  • Searchbar#event:RadioTriggerSearchbarCheckInitialSearch
Listens to Events:

Extends

Methods

abortSearch(triggeredBy){void}

modules/searchbar/model.js, line 109
If a search algorithm terminates the search, it is no longer necessary to wait for a result for this algorithm. Therefore, this search algorithm is marked as done.
Name Type Description
triggeredBy String Name of the calling search algorithm

changeFileExtension(src, ext){String}

modules/searchbar/model.js, line 293
changes the filename extension of given filepath
Name Type Description
src String source string
ext String file extension
Returns:
extension

changeLang(lng){Void}

modules/searchbar/model.js, line 88
change language - sets default values for the language. If contents from config.json are translated, this is respected here by using the function "i18nextTranslate".
Name Type Description
lng String the language changed to

checkInitialSearch(){void}

modules/searchbar/model.js, line 122
Checks whether all search algorithms of the initial search have been processed.

checkInitialSearchResult(results){void}

modules/searchbar/model.js, line 151
Creates a user message if the initialSearch has no results to inform the user.
Name Type Description
results Array.<Object> recommendedList
Fires:

createRecommendedList(triggeredBy){void}

modules/searchbar/model.js, line 326
Generate a list with hits of the individual search algorithms.
Name Type Description
triggeredBy String Calling search algorithm
Fires:
  • Searchbar#event:RadioTriggerSearchbarCheckInitialSearch
  • ViewZoom#event:RadioTriggerViewZoomHitSelected

getRandomEntriesOfEachType(hitList, maxLength){Array.<Object>}

modules/searchbar/model.js, line 367
Name Type Description
hitList Array.<Object> List of all hits from searchbar.
maxLength Number Configured number of hits to be shown.
Returns:
random Entries. mimum length is given by attribute "maxLength".

getRandomEntryByType(hitList, type){Object}

modules/searchbar/model.js, line 399
Filters the hitList by type and returns an random object of the list.
Name Type Description
hitList Array.<Object> List of all hits from searchbar.
type String Type of search.
Returns:
random object of hitlist by given type.

prepareTypeList(hitList){Array.<Object>}

modules/searchbar/model.js, line 411
Sorts the hitList by type.
Name Type Description
hitList Array.<Object> Hitlist.
Returns:
sorted Hits by Type

pushHits(attribute, value, evtType){void}

modules/searchbar/model.js, line 237
Help method to set an attribute of type Array.
Name Type Description
attribute String todo
value String todo
evtType event todo
Fires:
  • ViewZoom#event:RadioTriggerViewZoomHitSelected

removeHits(attribute, filter){Void}

modules/searchbar/model.js, line 267
Removes all hits with the given filter
Name Type Description
attribute string object to be filtered
filter Array.<object> filter parameters

setEventType(value){void}

modules/searchbar/model.js, line 473
Setter for "eventType"
Name Type Description
value String eventType

setHitIsClick(value){void}

modules/searchbar/model.js, line 500
Setter for "hitIsClick"
Name Type Description
value String hitIsClick

setHitList(value){void}

modules/searchbar/model.js, line 446
Setter for attribute "hitList".
Name Type Description
value Array.<Object> hitList.

setInitialSearchTasks(config){void}

modules/searchbar/model.js, line 165
Check by configuration which search algorithms are activated for initial search
Name Type Description
config Object Configuration

setInitSearchString(value){void}

modules/searchbar/model.js, line 195
Setter for attribute "initSearchString".
Name Type Description
value String Search string for initial search.

setQuickHelp(value){void}

modules/searchbar/model.js, line 491
Setter for "quickHelp"
Name Type Description
value String quickHelp

setRecommendedList(value){void}

modules/searchbar/model.js, line 437
Setter for attribute "recommendedList".
Name Type Description
value Array.<Object> recommendedList.

setSearchFieldisSelected(value){void}

modules/searchbar/model.js, line 482
Setter for "searchFieldisSelected"
Name Type Description
value String searchFieldisSelected

setSearchString(value, eventType){void}

modules/searchbar/model.js, line 207
called from view
Name Type Description
value string value from event
eventType string type of the event
Fires:

setTempCounter(value){void}

modules/searchbar/model.js, line 464
Setter for "tempCounter"
Name Type Description
value String tempCounter

setTypeList(value){void}

modules/searchbar/model.js, line 455
Setter for attribute "typeList".
Name Type Description
value Array.<Object> typeList.

shortenString(s, length){string}

modules/searchbar/model.js, line 309
crops names of hits to length zeichen
Name Type Description
s String todo
length number todo
Returns:
todo