2.0.0 • Published 5 months ago

@digitransit-search-util/digitransit-search-util-helpers v2.0.0

Weekly downloads
247
License
(AGPL-3.0 OR EUPL...
Repository
github
Last release
5 months ago

@digitransit-search-util/digitransit-search-util-helpers

LayerType

LayerType depicts the type of the point-of-interest.

match

Tries to match the given search term agains the collection of properties for a geocoding result. The best match will be returned (min: 0, max: 1.5).

Parameters

  • normalizedTerm string the normalized search term.
  • resultProperties any the geocoding result's property collection.

getLayerRank

Ranks the result based on its layer property.

Parameters

  • layer string the layer property.
  • source string the source property.

sortSearchResults

Helper function to sort the results. Orders as follows:

  • current position first for an empty search
  • matching routes first
  • otherwise by confidence, except that:
    • boost well matching stations (especially from GTFS)
    • rank stops lower as they tend to occupy most of the search results
  • items with no confidence (old searches and favorites):
    • rank favourites better than ordinary old searches
    • rank full match better than partial match
    • rank match at middle word lower than match at the beginning

Parameters

  • config
  • results Array<any> The search results that were received
  • term String The search term that was used (optional, default '')

This module is part of the Digitransit-ui project. It is maintained in the HSLdevcom/digitransit-ui repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install @digitransit-search-util/digitransit-search-util-helpers

Or install the Digitransit-util module that includes it as a function:

$ npm install @digitransit-util/digitransit-util
2.0.0

5 months ago

1.0.6

5 months ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.6

2 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago