Categorygithub.com/blevesearch/bleve/v2
modulepackage
2.4.4
Repository: https://github.com/blevesearch/bleve.git
Documentation: pkg.go.dev

# README

bleve bleve

Tests Coverage Status GoDoc Join the chat at https://gitter.im/blevesearch/bleve codebeat Go Report Card Sourcegraph License

A modern indexing + search library in GO

Features

  • Index any GO data structure or JSON
  • Intelligent defaults backed up by powerful configuration (scorch)
  • Supported field types:
    • text, number, datetime, boolean, geopoint, geoshape, IP, vector
  • Supported query types:
    • term, phrase, match, match_phrase, prefix, regexp, wildcard, fuzzy
    • term range, numeric range, date range, boolean field
    • compound queries: conjuncts, disjuncts, boolean (must/should/must_not)
    • query string syntax
    • geo spatial search
    • approximate k-nearest neighbors via vector search
  • tf-idf scoring
  • Hybrid search: exact + semantic
  • Query time boosting
  • Search result match highlighting with document fragments
  • Aggregations/faceting support:
    • terms facet
    • numeric range facet
    • date range facet

Indexing

message := struct{
	Id   string
	From string
	Body string
}{
	Id:   "example",
	From: "[email protected]",
	Body: "bleve indexing is easy",
}

mapping := bleve.NewIndexMapping()
index, err := bleve.New("example.bleve", mapping)
if err != nil {
	panic(err)
}
index.Index(message.Id, message)

Querying

index, _ := bleve.Open("example.bleve")
query := bleve.NewQueryStringQuery("bleve")
searchRequest := bleve.NewSearchRequest(query)
searchResult, _ := index.Search(searchRequest)

Command Line Interface

To install the CLI for the latest release of bleve, run:

$ go install github.com/blevesearch/bleve/v2/cmd/bleve@latest
$ bleve --help
Bleve is a command-line tool to interact with a bleve index.

Usage:
  bleve [command]

Available Commands:
  bulk        bulk loads from newline delimited JSON files
  check       checks the contents of the index
  count       counts the number documents in the index
  create      creates a new index
  dictionary  prints the term dictionary for the specified field in the index
  dump        dumps the contents of the index
  fields      lists the fields in this index
  help        Help about any command
  index       adds the files to the index
  mapping     prints the mapping used for this index
  query       queries the index
  registry    registry lists the bleve components compiled into this executable
  scorch      command-line tool to interact with a scorch index

Flags:
  -h, --help   help for bleve

Use "bleve [command] --help" for more information about a command.

Text Analysis

Bleve includes general-purpose analyzers (customizable) as well as pre-built text analyzers for the following languages:

Arabic (ar), Bulgarian (bg), Catalan (ca), Chinese-Japanese-Korean (cjk), Kurdish (ckb), Danish (da), German (de), Greek (el), English (en), Spanish - Castilian (es), Basque (eu), Persian (fa), Finnish (fi), French (fr), Gaelic (ga), Spanish - Galician (gl), Hindi (hi), Croatian (hr), Hungarian (hu), Armenian (hy), Indonesian (id, in), Italian (it), Dutch (nl), Norwegian (no), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Swedish (sv), Turkish (tr)

Text Analysis Wizard

bleveanalysis.couchbase.com

Discussion/Issues

Discuss usage/development of bleve and/or report issues here:

License

Apache License Version 2.0

# Packages

# Functions

MemoryNeededForSearchResult is an exported helper function to determine the RAM needed to accommodate the results for a given search request.
MultiSearch executes a SearchRequest across multiple Index objects, then merges the results.
New index at the specified path, must not exist.
NewBooleanFieldMapping returns a default field mapping for booleans.
NewBooleanQuery creates a compound Query composed of several other Query objects.
NewBoolFieldQuery creates a new Query for boolean fields.
NewBuilder creates a builder, which will build an index at the specified path, using the specified mapping and options.
NewConjunctionQuery creates a new compound Query.
NewDateRangeInclusiveQuery creates a new Query for ranges of date values.
NewDateRangeInclusiveStringQuery creates a new Query for ranges of date values.
NewDateRangeQuery creates a new Query for ranges of date values.
NewDateRangeStringQuery creates a new Query for ranges of date values.
NewDateTimeFieldMapping returns a default field mapping for dates.
NewDisjunctionQuery creates a new compound Query.
NewDocIDQuery creates a new Query object returning indexed documents among the specified set.
NewDocumentDisabledMapping returns a new document mapping that will not perform any indexing.
NewDocumentMapping returns a new document mapping with all the default values.
NewDocumentStaticMapping returns a new document mapping that will not automatically index parts of a document without an explicit mapping.
NewFacetRequest creates a facet on the specified field that limits the number of entries to the specified size.
NewFuzzyQuery creates a new Query which finds documents containing terms within a specific fuzziness of the specified term.
NewGeoBoundingBoxQuery creates a new Query for performing geo bounding box searches.
NewGeoDistanceQuery creates a new Query for performing geo distance searches.
NewGeometryCollectionQuery creates a new query for the provided geometrycollection coordinates and types, which could contain multiple geo shapes.
NewGeoShapeCircleQuery creates a new query for a geoshape that is a circle given center point and the radius.
NewGeoShapeQuery creates a new Query for matching the given geo shape.
NewHighlight creates a default HighlightRequest.
NewHighlightWithStyle creates a HighlightRequest with an alternate style.
NewIndexAlias creates a new IndexAlias over the provided Index objects.
NewIndexMapping creates a new IndexMapping that will use all the default indexing rules.
NewIPRangeQuery creates a new Query for matching IP addresses.
NewKeywordFieldMapping returns a field mapping for text using the keyword analyzer, which essentially doesn't apply any specific text analysis.
NewMatchAllQuery creates a Query which will match all documents in the index.
NewMatchNoneQuery creates a Query which will not match any documents in the index.
NewMatchPhraseQuery creates a new Query object for matching phrases in the index.
NewMatchQuery creates a Query for matching text.
NewMemOnly creates a memory-only index.
NewNumericFieldMapping returns a default field mapping for numbers.
NewNumericRangeInclusiveQuery creates a new Query for ranges of numeric values.
NewNumericRangeQuery creates a new Query for ranges of numeric values.
NewPhraseQuery creates a new Query for finding exact term phrases in the index.
NewPrefixQuery creates a new Query which finds documents containing terms that start with the specified prefix.
NewQueryStringQuery creates a new Query used for finding documents that satisfy a query string.
NewRegexpQuery creates a new Query which finds documents containing terms that match the specified regular expression.
NewSearchRequest creates a new SearchRequest for the Query, using default values for all other search parameters.
NewSearchRequestOptions creates a new SearchRequest for the Query, with the requested size, from and explanation search parameters.
NewTermQuery creates a new Query for finding an exact term match in the index.
NewTermRangeInclusiveQuery creates a new Query for ranges of text terms.
NewTermRangeQuery creates a new Query for ranges of text terms.
NewTextFieldMapping returns a default field mapping for text.
NewUsing creates index at the specified path, which must not already exist.
NewWildcardQuery creates a new Query which finds documents containing terms that match the specified wildcard.
Open index at the specified path, must exist.
OpenUsing opens index at the specified path, must exist.
SetLog sets the logger used for logging by default log messages are sent to io.Discard.

# Constants

Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.
Constant Error values which can be compared to determine the type of error.

# Variables

Config contains library level configuration.

# Structs

A Batch groups together multiple Index and Delete operations you would like performed at the same time.
A FacetRequest describes a facet or aggregation of the result document set you would like to be built.
HighlightRequest describes how field matches should be highlighted.
A SearchRequest describes all the parameters needed to search the index.
A SearchResult describes the results of executing a SearchRequest.
SearchStatus is a secion in the SearchResult reporting how many underlying indexes were queried, how many were successful/failed and a map of any errors that were encountered.

# Interfaces

Builder is a limited interface, used to build indexes in an offline mode.
An Index implements all the indexing and searching capabilities of bleve.
An IndexAlias is a wrapper around one or more Index objects.
IndexCopyable is an index which supports an online copy operation of the index.

# Type aliases

Error represents a more strongly typed bleve error for detecting and handling specific types of errors.
FacetsRequest groups together all the FacetRequest objects for a single query.
FileSystemDirectory is the default implementation for the index.Directory interface.
IndexErrMap tracks errors with the name of the index where it occurred.