Qiitable is a Node.JS module to parse Qiita-like search queries.
This module is perfect for integrating complex search (like Qiita search) into your application.
Type | Example |
---|---|
Query for tags | Ruby |
Query for multiple tags | Ruby Rails , "Ruby on Rails" |
Query for equality | user:sampleuser , user:"sample user" |
Query for not-equality | -user:sampleuser |
Query for values greater than another value | stocks:>10 , stocks:>=10 |
Query for values less than another value | stocks:<100 , stocks:<=100 |
Install it using:
$ npm install qiitable
Parse a query string:
var qiitable = require("qiitable");
var query = qiitable.Query('Ruby created:>=2020-01-01').parse();
Filter and customize queries using QueryBuilder
:
var builder = qiitable.QueryBuilder();
// Define mapping, by default all fields are accepted and piped as string
builder.field('stocks', {
type: Number
});
builder.field('created', {
type: Date
});
// Reject a field
builder.reject('email');
// Parse queries (return a Query object)
builder.parse('Ruby stocks:>=10 created:>=2020-01-01')
This project started as a fork of GitbookIO/filterable.