Method: Lcms::Engine::Search::Repository#all_query

Defined in:
app/models/lcms/engine/search/repository.rb

#all_query(options) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'app/models/lcms/engine/search/repository.rb', line 83

def all_query(options)
  limit = options.fetch(:per_page, 20)
  page = options.fetch(:page, 1)

  query = {
    query: {
      bool: {
        must: { match_all: {} },
        filter: []
      }
    },
    sort: [
      { subject: 'asc' },
      { position: 'asc' },
      { 'title.key' => 'asc' }
    ],
    size: limit,
    from: (page - 1) * limit
  }

  apply_filters(query, options)
end