Filterable
Parse and convert GitHub-like search queries in Node.JS
Install / Use
/learn @GitbookIO/FilterableREADME
Filterable
Filterable is a Node.JS module to parse GitHub-like search queries, for example: cats stars:>10. It can generate MongoDB or Elasticsearch queries.
This module is perfect for integrating complex search (like GitHub search) into your application. It integrates perfectly with MongoDB but can also easily be adapted to other databases.
Queries
| Type | Example |
| ---- | ------- |
| Query for tags | cat |
| Query for multiple tags | cat dog, "Hello World" |
| Exclude results containing a certain word | cat NOT dog |
| Query for equality | username:Samypesse, name:"Samy Pesse" |
| Query for values greater than another value | stars:>10, stars:>=10 |
| Query for values less than another value | stars:<100, stars:<=100 |
| Mix query for tags and condition | cat stars:>10 stars:<100 |
| Filter qualifiers based on exclusion | cats stars:>10 NOT language:javascript |
How to use it?
Install it using:
$ npm install filterable
Parse a query string:
var filterable = require("filterable");
var query = filterable.Query('cats stars:>10')
.parse();
Output query for a database:
var mongQuery = query.toMongo();
Filter and customize queries using QueryBuilder:
var builder = filterable.QueryBuilder({
// Field using when quering with text
textField: 'description'
});
// Define mapping, by default all fields are accepted and piped as string
builder.field('stars', {
type: Number
});
// Reject a field
builder.reject('email');
// Parse queries (return a Query object)
var q1 = builder.parse('Hello world')
var q2 = builder.parse('cats stars:>10');
Related Skills
node-connect
353.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

