Documentation
¶
Overview ¶
Package search provides Gmail-like search query parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶ added in v0.4.0
Parser holds configuration for query parsing.
func NewParser ¶ added in v0.4.0
func NewParser() *Parser
NewParser creates a Parser with default settings.
func (*Parser) Parse ¶ added in v0.4.0
Parse parses a Gmail-like search query string into a Query object.
Supported operators:
- from:, to:, cc:, bcc: - address filters
- subject: - subject text search
- label: or l: - label filter
- has:attachment - attachment filter
- before:, after: - date filters (YYYY-MM-DD)
- older_than:, newer_than: - relative date filters (e.g., 7d, 2w, 1m, 1y)
- larger:, smaller: - size filters (e.g., 5M, 100K)
- Bare words and "quoted phrases" - full-text search
type Query ¶
type Query struct {
TextTerms []string // Full-text search terms
FromAddrs []string // from: filters
ToAddrs []string // to: filters
CcAddrs []string // cc: filters
BccAddrs []string // bcc: filters
SubjectTerms []string // subject: filters
Labels []string // label: filters
HasAttachment *bool // has:attachment
BeforeDate *time.Time // before: filter
AfterDate *time.Time // after: filter
LargerThan *int64 // larger: filter (bytes)
SmallerThan *int64 // smaller: filter (bytes)
AccountID *int64 // in: account filter
HideDeleted bool // exclude messages where deleted_from_source_at IS NOT NULL
}
Query represents a parsed search query with all supported filters.
Click to show internal directories.
Click to hide internal directories.