MCPcopy Create free account
hub / github.com/apache/answer-plugins / SearchContents

Method SearchContents

search-elasticsearch/es.go:66–81  ·  view source on GitHub ↗
(
	ctx context.Context, cond *plugin.SearchBasicCond)

Source from the content-addressed store, hash-verified

64}
65
66func (s *SearchEngine) SearchContents(
67 ctx context.Context, cond *plugin.SearchBasicCond) (
68 res []plugin.SearchResult, total int64, err error) {
69 if s.Operator == nil {
70 return nil, 0, fmt.Errorf("es client not init")
71 }
72 resp, err := s.Operator.QueryDoc(ctx, s.getIndexName(),
73 s.buildQuery(cond), s.buildSort(cond), s.buildCols(), cond.Page, cond.PageSize)
74 if err != nil {
75 return nil, 0, fmt.Errorf("es query error: %w", err)
76 }
77 if resp == nil {
78 return nil, 0, nil
79 }
80 return s.warpResult(resp)
81}
82
83func (s *SearchEngine) SearchQuestions(
84 ctx context.Context, cond *plugin.SearchBasicCond) (

Callers

nothing calls this directly

Calls 6

getIndexNameMethod · 0.95
buildQueryMethod · 0.95
buildSortMethod · 0.95
buildColsMethod · 0.95
warpResultMethod · 0.95
QueryDocMethod · 0.80

Tested by

no test coverage detected