searchservice

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const TopicIndex = "topics"

TopicIndex is the Meilisearch index for topic documents.

Variables

This section is empty.

Functions

func BuildSingleTopicSearchDocument added in v0.2.49

func BuildSingleTopicSearchDocument(topic *topics.Entity, firstPost *posts.Entity) (*meilisearch.TaskInfo, error)

Types

type IndexBuildResult

type IndexBuildResult struct {
	ProcessedCount int    `json:"processedCount"`
	FailedCount    int    `json:"failedCount"`
	TotalBatches   int    `json:"totalBatches"`
	IndexName      string `json:"indexName"`
}

IndexBuildResult summarizes a Meilisearch rebuild.

func BuildMeilisearchIndex

func BuildMeilisearchIndex() (*IndexBuildResult, error)

BuildMeilisearchIndex rebuilds the Meilisearch topic index.

type SearchRequest

type SearchRequest struct {
	Query      string   `json:"query"`
	Categories []uint64 `json:"categories"`
	Limit      int      `json:"limit"`
	Offset     int      `json:"offset"`
}

SearchRequest is a topic search request.

type SearchResponse

type SearchResponse struct {
	Results []SearchResult `json:"results"`
	Total   int64          `json:"total"`
}

SearchResponse is the topic search response.

func SearchTopics added in v0.2.49

func SearchTopics(req SearchRequest) (*SearchResponse, error)

SearchTopics returns topic IDs and titles directly from Meilisearch.

type SearchResult

type SearchResult struct {
	ID    uint64 `json:"id"`
	Title string `json:"title"`
}

SearchResult is one search hit.

type TopicSearchDocument added in v0.2.49

type TopicSearchDocument struct {
	ID            uint64   `json:"id"`
	Title         string   `json:"title"`         // 主要搜索字段
	SearchContent string   `json:"searchContent"` // 优化后的搜索文本
	TopicStatus   int8     `json:"topicStatus"`   // 可过滤字段
	ProcessStatus int8     `json:"processStatus"` // 可过滤字段
	Category      []uint64 `json:"category"`
	CreatedAt     int64    `json:"createdAt"` // 时间戳(Unix)
	UpdatedAt     int64    `json:"updatedAt"` // 时间戳(Unix)
}

TopicSearchDocument 主题搜索文档结构

Jump to

Keyboard shortcuts

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