Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diplodoc-platform/search-extension
https://github.com/diplodoc-platform/search-extension
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/diplodoc-platform/search-extension
- Owner: diplodoc-platform
- License: mit
- Created: 2024-09-23T22:43:35.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-10-29T09:32:21.000Z (2 months ago)
- Last Synced: 2024-10-29T11:43:09.076Z (2 months ago)
- Language: TypeScript
- Size: 898 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Diplodoc search extension
[![NPM version](https://img.shields.io/npm/v/@diplodoc/search-extension.svg?style=flat)](https://www.npmjs.org/package/@diplodoc/search-extension)
This is an extension of the Diplodoc platform, which adds offline search functionality.
It uses [lunr](https://lunrjs.com/) searchThe extension contains some parts:
- [Indexer](#indexer)
- [Worker](#worker)## Indexer {#indexer}
Extracts text information from documents.
Prepares search index and search documents registry.Instance methods:
**add** - Adds new entry to search index
**release** - Dumps index and registry for target language.
## Worker {#worker}
Implements client search worker interface. Uses prepared in indexer lunr index to resolve search requests.
Extends search score algorithm:
- Adds `tolerance` behavior.
`tolerance=0` - only search for strict equal words
`tolerance=1` - also search for words with unspecified tail. `word*`
`tolerance=2` - also search for words with unspecified tail and head. `*word*`- Adds `confidence` behavior.
`phrased` - default. Additionally scores results by found phrase length
`sparsed` - Uses default lunr scoring algorithm.