Class: Solr::Query::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/solr/query/request.rb,
lib/solr/query/request/facet.rb,
lib/solr/query/request/filter.rb,
lib/solr/query/request/sorting.rb,
lib/solr/query/request/boosting.rb,
lib/solr/query/request/grouping.rb,
lib/solr/query/request/or_filter.rb,
lib/solr/query/request/and_filter.rb,
lib/solr/query/request/field_list.rb,
lib/solr/query/request/geo_filter.rb,
lib/solr/query/request/spellcheck.rb,
lib/solr/query/request/sorting/field.rb,
lib/solr/query/request/boost_magnitude.rb,
lib/solr/query/request/edismax_adapter.rb,
lib/solr/query/request/field_with_boost.rb,
lib/solr/query/request/sorting/function.rb,
lib/solr/query/request/shards_preference.rb,
lib/solr/query/request/boosting/geodist_function.rb,
lib/solr/query/request/boosting/ln_function_boost.rb,
lib/solr/query/request/shards_preferences/property.rb,
lib/solr/query/request/boosting/scale_function_boost.rb,
lib/solr/query/request/boosting/exists_boost_function.rb,
lib/solr/query/request/boosting/phrase_proximity_boost.rb,
lib/solr/query/request/boosting/dictionary_boost_function.rb,
lib/solr/query/request/boosting/ranking_field_boost_function.rb,
lib/solr/query/request/boosting/field_value_match_boost_function.rb,
lib/solr/query/request/boosting/recent_field_value_boost_function.rb,
lib/solr/query/request/boosting/field_value_less_than_boost_function.rb,
lib/solr/query/request/boosting/numeric_field_value_match_boost_function.rb,
lib/solr/query/request/boosting/textual_field_value_match_boost_function.rb

Defined Under Namespace

Modules: BoostMagnitude Classes: AndFilter, Boosting, EdismaxAdapter, Facet, FieldList, FieldWithBoost, Filter, GeoFilter, Grouping, OrFilter, ShardsPreference, ShardsPreferences, Sorting, Spellcheck

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_term:, query_fields: [], field_list: Solr::Query::Request::FieldList.new, filters: []) ⇒ Request

Returns a new instance of Request.



27
28
29
30
31
32
# File 'lib/solr/query/request.rb', line 27

def initialize(search_term:, query_fields: [], field_list: Solr::Query::Request::FieldList.new, filters: [])
  @search_term = search_term
  @query_fields = query_fields
  @field_list = field_list
  @filters = filters
end

Instance Attribute Details

#boostingObject

Returns the value of attribute boosting.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def boosting
  @boosting
end

#debug_modeObject

Returns the value of attribute debug_mode.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def debug_mode
  @debug_mode
end

#facetsObject

Returns the value of attribute facets.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def facets
  @facets
end

#field_listObject

Returns the value of attribute field_list.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def field_list
  @field_list
end

#filtersObject

Returns the value of attribute filters.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def filters
  @filters
end

#groupingObject



41
42
43
# File 'lib/solr/query/request.rb', line 41

def grouping
  @grouping ||= Solr::Query::Request::Grouping.none
end

#limit_docs_by_fieldObject

Returns the value of attribute limit_docs_by_field.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def limit_docs_by_field
  @limit_docs_by_field
end

#phrase_slopObject

Returns the value of attribute phrase_slop.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def phrase_slop
  @phrase_slop
end

#query_fieldsObject

Returns the value of attribute query_fields.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def query_fields
  @query_fields
end

#query_operatorObject

Returns the value of attribute query_operator.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def query_operator
  @query_operator
end

#search_termObject (readonly)

Returns the value of attribute search_term.



22
23
24
# File 'lib/solr/query/request.rb', line 22

def search_term
  @search_term
end

#shards_preferenceObject



49
50
51
# File 'lib/solr/query/request.rb', line 49

def shards_preference
  @shards_preference ||= Solr::Query::Request::ShardsPreference.none
end

#sortingObject



45
46
47
# File 'lib/solr/query/request.rb', line 45

def sorting
  @sorting ||= Solr::Query::Request::Sorting.none
end

#spellcheckObject

Returns the value of attribute spellcheck.



23
24
25
# File 'lib/solr/query/request.rb', line 23

def spellcheck
  @spellcheck
end

Instance Method Details

#run(page: nil, start: nil, rows: nil, page_size: nil, runner_options: {}) ⇒ Object

Raises:

  • (ArgumentError)


34
35
36
37
38
39
# File 'lib/solr/query/request.rb', line 34

def run(page: nil, start: nil, rows: nil, page_size: nil, runner_options: {})
  rows ||= page_size
  return run_paged(page: page, page_size: rows, runner_options: runner_options) if page && rows
  return run_start(start: start, rows: rows, runner_options: runner_options) if start && rows
  raise ArgumentError, 'You must specify either page/rows or start/rows arguments'
end

#to_hObject



53
54
55
# File 'lib/solr/query/request.rb', line 53

def to_h
  Solr::Query::Request::EdismaxAdapter.new(self).to_h
end