search

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package search contains all the required functions to find work items Following different patterns and filter options.

Index

Constants

View Source
const (
	HostRegistrationKeyForListWI  = "work-item-list-details"
	HostRegistrationKeyForBoardWI = "work-item-board-details"

	EQ     = "$EQ"
	NE     = "$NE"
	AND    = "$AND"
	OR     = "$OR"
	NOT    = "$NOT"
	IN     = "$IN"
	SUBSTR = "$SUBSTR"
	OPTS   = "$OPTS"

	// This is the replacement for $WITGROUP.
	TypeGroupName = "typegroup.name"

	OptParentExistsKey = "parent-exists"
	OptTreeViewKey     = "tree-view"
)

KnownURL registration key constants

Variables

This section is empty.

Functions

func GetAllRegisteredURLs

func GetAllRegisteredURLs() map[string]KnownURL

GetAllRegisteredURLs returns all known URLs

func RegisterAsKnownURL

func RegisterAsKnownURL(name, urlRegex string)

RegisterAsKnownURL appends to KnownURLs

Types

type GormSearchRepository

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

GormSearchRepository provides a Gorm based repository

func NewGormSearchRepository

func NewGormSearchRepository(db *gorm.DB) *GormSearchRepository

NewGormSearchRepository creates a new search repository

func (*GormSearchRepository) Filter

func (r *GormSearchRepository) Filter(ctx context.Context, rawFilterString string, parentExists *bool, start *int, limit *int) (matches []workitem.WorkItem, count int, ancestors link.AncestorList, childLinks link.WorkItemLinkList, err error)

Filter returns the work items matching the search as well as their count. If the filter did specify the "tree-view" option to be "true", then we will also create a list of ancestors as well as a list of links. The ancestors exist in order to list the parent of each matching work item up to its root work item. The child links are there in order to know what siblings to load for matching work items.

func (*GormSearchRepository) SearchFullText

func (r *GormSearchRepository) SearchFullText(ctx context.Context, rawSearchString string, start *int, limit *int, spaceID *string) ([]workitem.WorkItem, int, error)

SearchFullText Search returns work items for the given query

type KnownURL

type KnownURL struct {
	URLRegex string // regex for URL, Exposed to make the code testable
	// contains filtered or unexported fields
}

KnownURL has a regex string format URL and compiled regex for the same

type Query

type Query struct {
	// Name can contain a field name to search for (e.g. "space") or one of the
	// binary operators "$AND", or "$OR". If the Name is not an operator, we
	// compare the Value against a column in the database that maps to this
	// Name. We check the Value for equality and for inequality if the Negate
	// field is set to true.
	Name string
	// Operator nodes, with names "$AND", "$OR" etc. will not have values.
	// Since this struct represents tail nodes as well as these operator nodes,
	// the pointer is more suitable.
	Value *string
	// When Negate is true the comparison desribed above is negated; hence we
	// check for inequality. When Name is an operator, the Negate field has no
	// effect.
	Negate bool
	// If Substring is true, instead of exact match, anything that matches partially
	// will be considered.
	Substring bool
	// A Query is expected to have child queries only if the Name field contains
	// an operator like "$AND", or "$OR". If the Name is not an operator, the
	// Children slice MUST be empty.
	Children []Query
	// The Options represent the query options provided by the user.
	Options *QueryOptions
}

Query represents tree structure of the filter query

type QueryOptions

type QueryOptions struct {
	TreeView     bool
	ParentExists bool
}

QueryOptions represents all options provided user

func ParseFilterString

func ParseFilterString(ctx context.Context, rawSearchString string) (criteria.Expression, *QueryOptions, error)

ParseFilterString accepts a raw string and generates a criteria expression

Jump to

Keyboard shortcuts

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