cypress

package
v0.0.0-...-1ffa49a Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TGChatID2TanantID

func TGChatID2TanantID(chatID int64) string

Types

type API

type API struct {
	Endpoint     string
	TermMustMode bool
}

API :Cypress API struct Endpoint: cypress api endpoint TermMustMode = true: add cy_termmust=true to the cypress api request url url

func (*API) SearchWithClause

func (api *API) SearchWithClause(searchclause *SearchClause, chatID int64) (*Result, error)

SearchWithClause : request the search result from cypress serach API

func (*API) Update

func (api *API) Update(doc *ChatDocument)

Update send the ChatDocument to the cypress update API

type ChatDocument

type ChatDocument struct {
	XMLName   xml.Name  `xml:"node"`
	TenantID  *TenantID `xml:"cy_tenantid"`
	URI       string    `xml:"uri"`
	XMLURI    string    `xml:"xmluri"`
	Title     *Title    `xml:"title"`
	Content   *Content  `xml:"content"`
	IsReply   bool      `xml:"isreply"`
	ChatID    int64     `xml:"chatid"`
	MessageID int       `xml:"messsageid"`
	UserID    int       `xml:"userid"`
	UserName  string    `xml:"username"`
	Date      *Date     `xml:"newdate"`
}

ChatDocument is the Cypress Document Node

func TelegramMessageToDocument

func TelegramMessageToDocument(msg *tgbotapi.Message) *ChatDocument

TelegramMessageToDocument make ChatDocument Instances from Telegram Messages

type Content

type Content struct {
	XMLName xml.Name `xml:"content"`
	Text    string   `xml:",cdata"`
}

Content is the Cypress Document Content Node

type Date

type Date struct {
	XMLName xml.Name `xml:"newdate"`
	Type    string   `xml:"type,attr"`
	Text    int      `xml:",chardata"`
}

Date is the Cypress Document Date Node

type Item

type Item struct {
	NewDate    string  `json:"newdate"`
	Date       string  `json:"date"`
	Match      float32 `json:"cypress.match"`
	IsReply    string  `json:"isreply"`
	MesssageID string  `json:"messsageid"`
	ChatID     string  `json:"chatid"`
	Title      string  `json:"title"`
	URI        string  `json:"uri"`
	UserID     string  `json:"userid"`
	UserName   string  `json:"username"`
	Content    string  `json:"content"`
}

Item is search hit item node

type Result

type Result struct {
	Spellcorrect string `json:"spellcorrect"`
	Segment      string `json:"segment"`
	Count        int    `json:"count"`
	Querywords   string `json:"querywords"`
	Time         int    `json:"time"`
	Items        []Item `json:"items"`
}

Result is the child node of the top node

type SearchClause

type SearchClause struct {
	Queryword string             `json:"q"`
	Conf      string             `json:"c"`
	Start     int                `json:"s"`
	Num       int                `json:"n"`
	Restrict  *map[string]string `json:"r"`
	Params    *map[string]string `json:"p"`
}

type SearchResult

type SearchResult struct {
	Result Result `json:"result"`
}

SearchResult is the Cypress Search result top node

type TenantID

type TenantID struct {
	XMLName xml.Name `xml:"cy_tenantid"`
	Type    string   `xml:"type,attr"`
	Text    string   `xml:",chardata"`
}

type Title

type Title struct {
	XMLName xml.Name `xml:"title"`
	Text    string   `xml:",cdata"`
}

Title is the Cypress Document Title Node

Jump to

Keyboard shortcuts

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