MCPcopy Index your code
hub / github.com/apache/answer-plugins / SearchQuestions

Method SearchQuestions

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

Source from the content-addressed store, hash-verified

81}
82
83func (s *SearchEngine) SearchQuestions(
84 ctx context.Context, cond *plugin.SearchBasicCond) (
85 res []plugin.SearchResult, total int64, err error) {
86 if s.Operator == nil {
87 return nil, 0, fmt.Errorf("es client not init")
88 }
89 query := s.buildQuery(cond)
90 query.Must(elastic.NewTermQuery("type", "question"))
91 resp, err := s.Operator.QueryDoc(ctx, s.getIndexName(),
92 query, s.buildSort(cond), s.buildCols(), cond.Page, cond.PageSize)
93 if err != nil {
94 return nil, 0, fmt.Errorf("es query error: %w", err)
95 }
96 if resp == nil {
97 return nil, 0, nil
98 }
99 return s.warpResult(resp)
100}
101
102func (s *SearchEngine) SearchAnswers(
103 ctx context.Context, cond *plugin.SearchBasicCond) (

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected