Documentation ¶
Index ¶
- Constants
- func LowerRegexp(r *syntax.Regexp) *syntax.Regexp
- func OptimizeRegexp(re *syntax.Regexp, flags syntax.Flags) *syntax.Regexp
- func QToProto(q Q) *proto.Q
- func VisitAtoms(q Q, v func(q Q))
- type And
- type Boost
- type Branch
- type BranchRepos
- type BranchesRepos
- type Const
- type FileNameSet
- type Language
- type Not
- type Or
- type Q
- type RawConfig
- type Regexp
- type Repo
- type RepoIDs
- type RepoRegexp
- type RepoSet
- type Substring
- type Symbol
- type Type
Constants ¶
const ( TypeFileMatch uint8 = iota TypeFileName TypeRepo )
Variables ¶
This section is empty.
Functions ¶
func OptimizeRegexp ¶
OptimizeRegexp converts capturing groups to non-capturing groups. Returns original input if an error is encountered
func VisitAtoms ¶
VisitAtoms runs `v` on all atom queries within `q`.
Types ¶
type Boost ¶
type Boost struct { Child Q // Boost will multiply the score of its descendents. Values less than 1 will // give less importance while values greater than 1 will give more // importance. Boost float64 }
Boost scales the contribution to score of descendents.
type Branch ¶
type Branch struct { Pattern string // exact is true if we want to Pattern to equal branch. Exact bool }
Branch limits search to a specific branch.
func BranchFromProto ¶
type BranchRepos ¶
BranchRepos is a (branch, sourcegraph repo ids bitmap) tuple. It is a Sourcegraph addition.
func BranchReposFromProto ¶
func BranchReposFromProto(p *proto.BranchRepos) (BranchRepos, error)
func (*BranchRepos) ToProto ¶
func (br *BranchRepos) ToProto() *proto.BranchRepos
type BranchesRepos ¶
type BranchesRepos struct {
List []BranchRepos
}
BranchesRepos is a slice of BranchRepos to match. It is a Sourcegraph addition and only used in the RPC interface for efficient checking of large repo lists.
func BranchesReposFromProto ¶
func BranchesReposFromProto(p *proto.BranchesRepos) (*BranchesRepos, error)
func NewSingleBranchesRepos ¶
func NewSingleBranchesRepos(branch string, ids ...uint32) *BranchesRepos
NewSingleBranchesRepos is a helper for creating a BranchesRepos which searches a single branch.
func (BranchesRepos) MarshalBinary ¶
func (q BranchesRepos) MarshalBinary() ([]byte, error)
MarshalBinary implements a specialized encoder for BranchesRepos.
func (*BranchesRepos) String ¶
func (q *BranchesRepos) String() string
func (*BranchesRepos) ToProto ¶
func (br *BranchesRepos) ToProto() *proto.BranchesRepos
func (*BranchesRepos) UnmarshalBinary ¶
func (q *BranchesRepos) UnmarshalBinary(b []byte) (err error)
UnmarshalBinary implements a specialized decoder for BranchesRepos.
type FileNameSet ¶
type FileNameSet struct {
Set map[string]struct{}
}
FileNameSet is a list of file names to match. It is a Sourcegraph addition and only used in the RPC interface for efficient checking of large file lists.
func FileNameSetFromProto ¶
func FileNameSetFromProto(p *proto.FileNameSet) *FileNameSet
func NewFileNameSet ¶
func NewFileNameSet(fileNames ...string) *FileNameSet
func (*FileNameSet) MarshalBinary ¶
func (q *FileNameSet) MarshalBinary() ([]byte, error)
MarshalBinary implements a specialized encoder for FileNameSet.
func (*FileNameSet) String ¶
func (q *FileNameSet) String() string
func (*FileNameSet) ToProto ¶
func (q *FileNameSet) ToProto() *proto.FileNameSet
func (*FileNameSet) UnmarshalBinary ¶
func (q *FileNameSet) UnmarshalBinary(b []byte) error
UnmarshalBinary implements a specialized decoder for FileNameSet.
type Q ¶
type Q interface {
String() string
}
Q is a representation for a possibly hierarchical search query.
func ExpandFileContent ¶
Expand expands Substr queries into (OR file_substr content_substr) queries, and the same for Regexp queries..
func RegexpQuery ¶
RegexpQuery parses an atom into either a regular expression, or a simple substring atom.
type RawConfig ¶
type RawConfig uint64
RawConfig filters repositories based on their encoded RawConfig map.
func RawConfigFromProto ¶
type Regexp ¶
RegexpQuery is a query looking for regular expressions matches.
type RepoIDs ¶
Similar to BranchRepos but will be used to match only by repoid and therefore matches all branches
func NewRepoIDs ¶
NewRepoIDs is a helper for creating a RepoIDs which searches only the matched repos.
type RepoRegexp ¶
RepoRegexp is a Sourcegraph addition which searches documents where the repository name matches Regexp.
func RepoRegexpFromProto ¶
func RepoRegexpFromProto(p *proto.RepoRegexp) (*RepoRegexp, error)
func (*RepoRegexp) GobDecode ¶
func (q *RepoRegexp) GobDecode(data []byte) error
GobDecode implements gob.Decoder.
func (*RepoRegexp) GobEncode ¶
func (q *RepoRegexp) GobEncode() ([]byte, error)
GobEncode implements gob.Encoder.
func (*RepoRegexp) String ¶
func (q *RepoRegexp) String() string
func (*RepoRegexp) ToProto ¶
func (q *RepoRegexp) ToProto() *proto.RepoRegexp
type RepoSet ¶
RepoSet is a list of repos to match. It is a Sourcegraph addition and only used in the RPC interface for efficient checking of large repo lists.
func NewRepoSet ¶
func RepoSetFromProto ¶
type Substring ¶
type Substring struct { Pattern string CaseSensitive bool // Match only filename FileName bool // Match only content Content bool }
Substring is the most basic query: a query for a substring.