https://github.com/vitonsky/search-queries
Simple and powerful parser for advanced search queries
https://github.com/vitonsky/search-queries
browser fulltext-search fulltextsearch javascript nodejs query-parser query-string search search-queries search-query search-query-nodejs searching typescript
Last synced: about 2 months ago
JSON representation
Simple and powerful parser for advanced search queries
- Host: GitHub
- URL: https://github.com/vitonsky/search-queries
- Owner: vitonsky
- License: mit
- Created: 2025-01-01T23:57:40.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-03-28T02:10:41.000Z (3 months ago)
- Last Synced: 2025-03-29T20:32:32.223Z (3 months ago)
- Topics: browser, fulltext-search, fulltextsearch, javascript, nodejs, query-parser, query-string, search, search-queries, search-query, search-query-nodejs, searching, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/search-queries
- Size: 635 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/search-queries) 
Simple and powerful parser for advanced search queries like [GitHub search queries](https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax).
# Usage
```ts
import { QueryParser } from 'search-queries';const parser = new QueryParser({ modifiers: ['!', '-'] });
const query = parser.parse(
`fancy words label:foo -label:bar and "multiple words string" -"excluded phrase"`
);// Yield object equal to
expect(query).toEqual([
{ value: 'fancy' },
{ value: 'words' },
{ keyword: 'label', value: 'foo' },
{ keyword: 'label', value: 'bar', modifier: '-' },
{ value: 'and' },
{ value: 'multiple words string' },
{ value: 'excluded phrase', modifier: '-' },
]);
```# API
TODO: add docs
# Development
`search-queries` is an truth open source project, so you are welcome on [project github repository](https://github.com/vitonsky/search-queries/) to contribute a code, [make issues](https://github.com/vitonsky/search-queries/issues/new/choose) with feature requests and bug reports.
You may contribute to a project if you tell about `search-queries` to your friends.