Class: SearchableData

SearchableData

Makes an array of objects searchable

new SearchableData(options)

Parameters:
Name Type Description
options Object SearchableData expects these properties:
Properties
Name Type Description
data object Array of data or a function that returns an array of data.
searchProperties string[] Array of property names in the data array to search in. If not added, all properties will be used
displaynameProperty string The name of the property in the data array that should be used as displayname
descriptionProperty string The name of the property in the data array that should be used as description
useAND boolean Use AND and not OR when multiple terms is added by the user. Default true
Source:
  • searchers/local/searchableData.js, line 12

Members

data

Array of data or a function that returns an array of data. If data is a function it will be called each time fetchData is called. This way the client could change the data on the fly and not keep them static. This could be used when adding an external filter.
Source:
  • searchers/local/searchableData.js, line 18

descriptionProperty

The name of the property in the data array that should be used as description.
Source:
  • searchers/local/searchableData.js, line 33

displaynameProperty

The name of the property in the data array that should be used as displayname.
Source:
  • searchers/local/searchableData.js, line 28

plural

Plural phrase, eg.: "features"
Source:
  • searchers/local/searchableData.js, line 48

searchProperties

Array of property names in the data array to search in. If not added, all properties will be used
Source:
  • searchers/local/searchableData.js, line 23

singular

Singular phrase, eg.: "feature"
Source:
  • searchers/local/searchableData.js, line 43

useAND

Use AND and not OR when multiple terms is added by the user. Set to false to use OR
Source:
  • searchers/local/searchableData.js, line 38

Methods

getDescription() → {String}

Used for getting the description
Source:
  • searchers/local/searchableData.js, line 147
Returns:
Type
String

getDisplayname() → {String}

Used for getting the displayname
Source:
  • searchers/local/searchableData.js, line 135
Returns:
Type
String

getScore() → {Integer}

Get the score for a single string
Source:
  • searchers/local/searchableData.js, line 189
Returns:
Type
Integer

match() → {Integer}

Method that defines what to search in
Source:
  • searchers/local/searchableData.js, line 159
Returns:
Type
Integer