Bluge, will this document match this query?

sour

PkgGoDev Tests Lint License

Will this bluge.Document match this bluge.Query? This library allows you to efficiently answer this question.

	s := sour.New(bluge.InMemoryOnlyConfig())

	s.Reset(bluge.NewDocument("id").
		AddField(bluge.NewKeywordField("name", "sour")))

	dmi, err := s.Search(context.Background(),
		bluge.NewTopNSearch(0, bluge.NewTermQuery("sour").SetField("name")).
		WithStandardAggregations())
	if err != nil {
		panic(err)
	}
	if dmi.Aggregations().Count() > 0 {
		fmt.Println("matches name sour")
	} else {
		fmt.Println("does not match name sour")
	}

Details

  • This implementation is NOT thread-safe. If you need to run multiple queries concurrently, you must use separate Sour instances.
  • Loading stored fields is not supported

Approach

  • Single document, data sizes are small.
  • Therefore, avoid heavy document analysis and complex data structures.
  • After regular document analysis is complete, use this structure in place.
  • Do not build more complicated structures like vellums or roaring bitmaps.
  • If additional structure is needed, prefer arrays which have good cache locality, and can be reused.
  • Avoid copying data, prefer sub-slicing, and brute-force processing over arrays.
  • Cache reusable parts of the query, as we expect the same query to be run over multiple documents.

License

Apache License Version 2.0

Similar Resources

Simple query builder for MongoDB

🌱 greenleaf - simple, type safe and easy to use query builder for MongoDB Installation To install use: go get github.com/slavabobik/greenleaf Quick

Nov 27, 2022

Easy JSON Query Processor with a Lispy syntax in Go

jql Hey there! You're probably here cause you're fed up with other json query processors being too complicated to use for anything surpassing simple s

Dec 22, 2022

gosq is a parsing engine for a simplicity-focused, template-based SQL query builder for Go.

gosq is a parsing engine for a simplicity-focused, template-based SQL query builder for Go.

Oct 24, 2022

SQL query helper

SQL query helper

Nov 7, 2021

Tag based url Query parameters Constructor.

taqc 🚕 Tag based url Query parameters Constructor. (This is pronounced as same as "taxi") Synopsis type Query struct { Foo string `ta

Jan 11, 2022

qclean lets you to clean up search query in japanese.

qclean qclean lets you to clean up search query in japanese. This is mainly used to remove wasted space. Quick Start package main var cleaner *qclean

Jan 4, 2022

Querydecoder - Optional query parameter decoder for Golang

Optional query parameter decoder for Golang Example import ( "github.com/ritwic

Nov 8, 2022

sqlc implements a Dynamic Query Builder for SQLC and more specifically MySQL queries.

sqlc-go-builder sqlc implements a Dynamic Query Builder for SQLC and more specifically MySQL queries. It implements a parser using vitess-go-sqlparser

May 9, 2023

Phalanx is a cloud-native full-text search and indexing server written in Go built on top of Bluge that provides endpoints through gRPC and traditional RESTful API.

Phalanx Phalanx is a cloud-native full-text search and indexing server written in Go built on top of Bluge that provides endpoints through gRPC and tr

Dec 25, 2022

XPath package for Golang, supports HTML, XML, JSON document query.

XPath XPath is Go package provides selecting nodes from XML, HTML or other documents using XPath expression. Implementation htmlquery - an XPath query

Dec 28, 2022

Go-Postgresql-Query-Builder - A query builder for Postgresql in Go

Postgresql Query Builder for Go This query builder aims to make complex queries

Nov 17, 2022

`go-redash-query` is a simple library to get structed data from `redash query` sources

go-redash-query go-redash-query is a simple library to get structed data from redash query sources Example Source table id name email 1 Dannyhann rhrn

May 22, 2022

Match regex group into go struct using struct tags and automatic parsing

regroup Simple library to match regex expression named groups into go struct using struct tags and automatic parsing Installing go get github.com/oris

Nov 5, 2022

Diff, match and patch text in Go

go-diff go-diff offers algorithms to perform operations required for synchronizing plain text: Compare two texts and return their differences. Perform

Dec 25, 2022

Automatically set GOMAXPROCS to match Linux container CPU quota.

automaxprocs Automatically set GOMAXPROCS to match Linux container CPU quota. Installation go get -u go.uber.org/automaxprocs Quick Start import _ "go

Dec 29, 2022

espnwrapper to track real time scores for your fav match... in a terminal while working.

espnwrapper to track real time scores for your fav match... in a terminal while working.

An espncricinfo wrapper written in go to track scores in real time and in the cmd/cli you can find the Command Line Interface wrapped over this wrapper.

Mar 13, 2022

AOE2 Definitive Edition Match Finder

AOE2 DE Match Finder AOE2 DE Match Finder is a Go library for fetching specific matches from the popular game Age of Empires 2 Definitive Edition. It

Jun 10, 2022

An easy to use relay for cftools webhook events piped to Discord when filter rules match.

CFTools Relay CFTools Relay is an easy-to-use, still in development, tool that allows you to subscribe to CFTools Cloud Webhook events and forward the

Nov 22, 2022

This package can parse date match expression, which used by ElasticSearch

datemath-parser this package is pure go package, this package can parse date match expression, which used by ElasticSearch. Date Math Definition you c

Jan 8, 2022
Go database query builder library for PostgreSQL

buildsqlx Go Database query builder library Installation Selects, Ordering, Limit & Offset GroupBy / Having Where, AndWhere, OrWhere clauses WhereIn /

Dec 23, 2022
SQL builder and query library for golang

__ _ ___ __ _ _ _ / _` |/ _ \ / _` | | | | | (_| | (_) | (_| | |_| | \__, |\___/ \__, |\__,_| |___/ |_| goqu is an expressive SQL bu

Dec 30, 2022
SQL query builder for Go

GoSQL Query builder with some handy utility functions. Documentation For full documentation see the pkg.go.dev or GitBook. Examples // Open database a

Dec 12, 2022
Type safe SQL builder with code generation and automatic query result data mapping
Type safe SQL builder with code generation and automatic query result data mapping

Jet Jet is a complete solution for efficient and high performance database access, consisting of type-safe SQL builder with code generation and automa

Jan 6, 2023
A Go (golang) package that enhances the standard database/sql package by providing powerful data retrieval methods as well as DB-agnostic query building capabilities.

ozzo-dbx Summary Description Requirements Installation Supported Databases Getting Started Connecting to Database Executing Queries Binding Parameters

Dec 31, 2022
Type safe SQL query builder and struct mapper for Go

sq (Structured Query) ?? ?? sq is a code-generated, type safe query builder and struct mapper for Go. ?? ?? Documentation • Reference • Examples This

Dec 19, 2022
Fast SQL query builder for Go

sqlf A fast SQL query builder for Go. sqlf statement builder provides a way to: Combine SQL statements from fragments of raw SQL and arguments that ma

Dec 23, 2022
Query AWS Athena and download the result as CSV.

Overview This tool can download an Athena SQL query results in CSV format. Installation Using Homebrew: $ brew tap flowerinthenight/tap $ brew install

Nov 11, 2021
Bulk query SQLite database over the network

SQLiteQueryServer Bulk query SQLite database over the network. Way faster than SQLiteProxy!

May 20, 2022
Query git repositories with SQL. Generate reports, perform status checks, analyze codebases. 🔍 📊

askgit askgit is a command-line tool for running SQL queries on git repositories. It's meant for ad-hoc querying of git repositories on disk through a

Jan 5, 2023