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

Method buildSort

search-elasticsearch/es.go:226–237  ·  view source on GitHub ↗
(cond *plugin.SearchBasicCond)

Source from the content-addressed store, hash-verified

224}
225
226func (s *SearchEngine) buildSort(cond *plugin.SearchBasicCond) (sort *elastic.FieldSort) {
227 switch cond.Order {
228 case plugin.SearchNewestOrder:
229 return elastic.NewFieldSort("created").Desc()
230 case plugin.SearchActiveOrder:
231 return elastic.NewFieldSort("active").Desc()
232 case plugin.SearchScoreOrder:
233 return elastic.NewFieldSort("score").Desc()
234 default:
235 return nil
236 }
237}
238
239func (s *SearchEngine) buildCols() (cols *elastic.FetchSourceContext) {
240 return elastic.NewFetchSourceContext(true).Include("id", "type")

Callers 3

SearchContentsMethod · 0.95
SearchQuestionsMethod · 0.95
SearchAnswersMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected