Documentation ¶
Overview ¶
* Meilindex - mail indexing and search tool. * Copyright (C) 2020 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * *
Index ¶
- func ParseAttachments(contentType string) string
- func SearchMail(query string, filter string)
- type Filter
- type Imap
- type Mail
- type Meilisearch
- func (m *Meilisearch) Connect() error
- func (m *Meilisearch) IndexComplete() bool
- func (m *Meilisearch) IndexMail(mails []*Mail) error
- func (m *Meilisearch) IndexMailBackground(mail []*Mail) error
- func (m *Meilisearch) Query(query, filter string) ([]*Mail, int, error)
- func (m *Meilisearch) RankingRules() (*[]string, error)
- func (m *Meilisearch) ServerVersion() (string, error)
- func (m *Meilisearch) SetRankingRules(rules []string) error
- func (m *Meilisearch) SetStopWords(words []string) error
- func (m *Meilisearch) SetSynonyms(synonyms *map[string][]string) error
- func (m *Meilisearch) Stats() ServerStats
- func (m *Meilisearch) StopWords() (*[]string, error)
- func (m *Meilisearch) Synonyms() (*map[string][]string, error)
- func (m *Meilisearch) WaitIndexComplete()
- type ServerStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAttachments ¶
func SearchMail ¶
Types ¶
type Filter ¶
Filter is structured filter from user to meilisearch.
type Imap ¶
type Imap struct { Url string Tls bool TlsSkipVerification bool Username string Password string // contains filtered or unexported fields }
func (*Imap) Disconnect ¶
func (*Imap) SelectMailbox ¶
type Mail ¶
type Mail struct { // Uid is hash calculated from id. Uid contains only ascii characters. Uid string `json:"uid"` // Original message id Id string `json:"id"` From string `json:"from"` To []string `json:"to"` Cc []string `json:"cc"` Subject string `json:"subject"` Body string `json:"body"` Timestamp time.Time `json:"date"` Folder string `json:"folder"` Attachments [][]byte AttachmentNames []string }
func ReadMailspring ¶ added in v0.2.0
func (*Mail) HighlightedBody ¶
func (*Mail) HighlightedFrom ¶
func (*Mail) HighlightedSubject ¶
func (*Mail) Sanitize ¶
func (m *Mail) Sanitize()
Sanitize makes various mail attributes nicer to read.
func (*Mail) ShortDateTime ¶
ShortDateTime returns short / simple format for date, today, yesterday at xx.xx, date
type Meilisearch ¶
type Meilisearch struct { Url string Index string ApiKey string // contains filtered or unexported fields }
Meilisearch is a connector to Meilisearch.
func NewMeiliSearch ¶
func NewMeiliSearch() (*Meilisearch, error)
NewMeilisearch creates new connection.
func (*Meilisearch) Connect ¶
func (m *Meilisearch) Connect() error
Connect creates a connection to meilisearch instance and initializes index if neccessary.
func (*Meilisearch) IndexComplete ¶
func (m *Meilisearch) IndexComplete() bool
func (*Meilisearch) IndexMail ¶
func (m *Meilisearch) IndexMail(mails []*Mail) error
func (*Meilisearch) IndexMailBackground ¶
func (m *Meilisearch) IndexMailBackground(mail []*Mail) error
IndexMailBackground runs multiple goroutines (num of cpus) to push mails to meilisearch. If all goroutines are busy, this call blocks as long as some goroutine is available.
func (*Meilisearch) RankingRules ¶
func (m *Meilisearch) RankingRules() (*[]string, error)
RankingRules returns a list of ranking rules. First rule is the most important, last is least important.
func (*Meilisearch) ServerVersion ¶
func (m *Meilisearch) ServerVersion() (string, error)
func (*Meilisearch) SetRankingRules ¶
func (m *Meilisearch) SetRankingRules(rules []string) error
func (*Meilisearch) SetStopWords ¶
func (m *Meilisearch) SetStopWords(words []string) error
func (*Meilisearch) SetSynonyms ¶
func (m *Meilisearch) SetSynonyms(synonyms *map[string][]string) error
func (*Meilisearch) Stats ¶
func (m *Meilisearch) Stats() ServerStats
func (*Meilisearch) StopWords ¶
func (m *Meilisearch) StopWords() (*[]string, error)
StopWords returns all stop words currently being used.
func (*Meilisearch) WaitIndexComplete ¶
func (m *Meilisearch) WaitIndexComplete()