https://github.com/netrixone/searchbox
Text input augmented with Lexer magic✨ to support advanced search features.
https://github.com/netrixone/searchbox
javascript lexer parser search searchbox text tokenizer typescript webkitty
Last synced: 9 months ago
JSON representation
Text input augmented with Lexer magic✨ to support advanced search features.
- Host: GitHub
- URL: https://github.com/netrixone/searchbox
- Owner: netrixone
- License: mit
- Created: 2019-09-19T11:13:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-24T22:04:34.000Z (over 5 years ago)
- Last Synced: 2025-03-18T00:14:26.427Z (10 months ago)
- Topics: javascript, lexer, parser, search, searchbox, text, tokenizer, typescript, webkitty
- Language: TypeScript
- Homepage:
- Size: 50.8 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Searchbox
🌐 stuchl4n3k.net | 💻 stuchl4n3k | 🐦 @stuchl4n3k
Text input augmented with Lexer magic✨ to support advanced search features. Searchbox supports multiple user-defined keywords (filters, variables) and also _NOT_ operator.
## Features
- [x] Parses user input string into a structured formula of literals.
- [x] Supports literal negation.
- [x] Supports unicode.
- [ ] Operators are configurable.
## Usage
```typescript
import * as searchbox from '@webkitty/searchbox';
const inputText = 'Never take title:raisins from -author:rabbits';
const keywords = ['title', 'author'];
const formula = searchbox.parse(inputText, {keywords});
// Formula:
// _: [Never,take,from] // words not matching any keyword (aka fulltext)
// title: [raisins] // "title" keyword match
// -author: [rabbits] // "author" keyword match with NOT operator ("-")
```
Please note that only **case-sensitive** keyword matching is supported.
## 📝 License
Copyright © 2019 [stuchl4n3k](https://github.com/stuchl4n3k).
This project is [MIT](LICENSE) licensed.
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fwebkitty%2Fsearchbox?ref=badge_large)