Skip to content

deoxxa/qs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

qs implements a query language for the Bleve text indexer library.

The query syntax is aiming to be about the same as those used by Lucene and Elasticsearch.

Usage

import "github.com/bcampbell/qs"

query, err := qs.Parse("grapefruit lemon orange lime")

Or, to create a parse which uses AND as the default operator:

p := qs.Parser{DefaultOp: qs.AND}
query,err := p.Parse("grapefruit lemon orange lime")

Quick Examples

Documents containing the term grapefruit:

grapefruit

There is support for boolean AND, OR and NOT:

grapefruit OR lemon
grapefruit AND lemon
grapefruit AND NOT lemon

Phrases are indicated with quotes:

"navel orange"

The default boolean operator is OR, so these two are equivalent when using the default parser:

grapefruit lemon
grapefruit OR lemon

Fields:

tags:citrus
headline:"How to Make the Perfect Negroni"

Grouping:

(lemon AND lime) OR (orange AND grapefruit)

Boosting term relevance:

fruit grapefruit^2

Inclusive ranges in square brackets, Exclusive ranges in curly brackets:

date:[2012-01-01 TO 2012-12-31]
count:{0 TO 100}

About

Query string parser for the Bleve text indexing library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%