ir

package
v0.0.0-...-492a895 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package ir contains code relating to the immediate representation query structure of a search strategy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BooleanQuery

type BooleanQuery struct {
	// A boolean operator (e.g. "and", "or", "not")
	Operator string `json:"operator"`
	// A list of Keywords that appear as queries grouped by the operator
	Keywords []Keyword `json:"keywords"`
	// Any sub-queries, or children of the current query
	Children []BooleanQuery `json:"children"`
	// Optional parameters of the query
	Options map[string]interface{}
}

BooleanQuery is the immediate representation of a boolean query for a search engine. This representation groups a list of keywords by a single operator, much like prefix notation. To combine operators, they can be added as children to a query. This means that there is no ambiguity to a query.

func (BooleanQuery) FieldCount

func (b BooleanQuery) FieldCount() (c map[string]int)

FieldCount extracts the count of fields in a query.

func (BooleanQuery) Fields

func (b BooleanQuery) Fields() (f []string)

Fields extracts the fields from the query.

func (BooleanQuery) Terms

func (b BooleanQuery) Terms() (s []string)

Terms extracts a list of query terms from the Boolean query.

type Keyword

type Keyword struct {
	QueryString string                 `json:"query"`
	Fields      []string               `json:"fields"`
	Exploded    bool                   `json:"exploded"`
	Truncated   bool                   `json:"truncated"`
	Options     map[string]interface{} `json:"options"`
}

Keyword represents a single string inside a search strategy. When these are reported, however, a keyword not only contains the phrase to search, but the fields in the database to search, how it is truncated, and if it is a mesh term, if the term has been exploded.

Jump to

Keyboard shortcuts

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