query

package
v1.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package query implements search query parsing and matching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match [2]int

Match is an array of [start, end] byte indexes for a match.

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query is a search query.

func Parse

func Parse(queryStr string) Query

Parse parses a search query string.

func (Query) FindAllIndex

func (q Query) FindAllIndex(text string) []Match

FindAllIndex returns a slice of all query match indexes in the text.

func (Query) Match

func (q Query) Match(pathStr string, text []byte) bool

Match reports whether the path or text contains at least 1 match of the query.

func (Query) Score

func (q Query) Score(pathStr string, text []byte) float64

Score scores the query match against the path and text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL