Class: MDEXClient::MData::NavigationQuery

Inherits:
Node
  • Object
show all
Defined in:
lib/mdex_client/mdata/navigation_query.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#element

Instance Method Summary collapse

Methods inherited from Node

#css, #dimension_value_state_list, #initialize, #initialize_from_element!, #property_list, #record_list, #xpath

Constructor Details

This class inherits a constructor from MDEXClient::MData::Node

Instance Attribute Details

#aggregation_keyObject

Returns the value of attribute aggregation_key.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def aggregation_key
  @aggregation_key
end

#alternative_phrasing_modeObject

Returns the value of attribute alternative_phrasing_mode.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def alternative_phrasing_mode
  @alternative_phrasing_mode
end

#analytics_expressionObject

Returns the value of attribute analytics_expression.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def analytics_expression
  @analytics_expression
end

#business_rules_filterObject

Returns the value of attribute business_rules_filter.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def business_rules_filter
  @business_rules_filter
end

#business_rules_preview_timeObject

Returns the value of attribute business_rules_preview_time.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def business_rules_preview_time
  @business_rules_preview_time
end

#dimension_value_strataObject

Returns the value of attribute dimension_value_strata.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def dimension_value_strata
  @dimension_value_strata
end

#enable_did_you_meanObject

Returns the value of attribute enable_did_you_mean.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def enable_did_you_mean
  @enable_did_you_mean
end

#eql_expressionObject

Returns the value of attribute eql_expression.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def eql_expression
  @eql_expression
end

#expose_all_refinementsObject

Returns the value of attribute expose_all_refinements.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def expose_all_refinements
  @expose_all_refinements
end

#included_record_attributesObject

Returns the value of attribute included_record_attributes.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def included_record_attributes
  @included_record_attributes
end

#language_idObject

Returns the value of attribute language_id.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def language_id
  @language_id
end

#range_filtersObject

Returns the value of attribute range_filters.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def range_filters
  @range_filters
end

#record_filterObject

Returns the value of attribute record_filter.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def record_filter
  @record_filter
end

#record_offsetObject

Returns the value of attribute record_offset.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def record_offset
  @record_offset
end

#records_per_pageObject

Returns the value of attribute records_per_page.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def records_per_page
  @records_per_page
end

#refinement_configsObject

Returns the value of attribute refinement_configs.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def refinement_configs
  @refinement_configs
end

#searchesObject

Returns the value of attribute searches.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def searches
  @searches
end

#selected_dimension_value_idsObject

Returns the value of attribute selected_dimension_value_ids.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def selected_dimension_value_ids
  @selected_dimension_value_ids
end

#sortsObject

Returns the value of attribute sorts.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def sorts
  @sorts
end

#user_profilesObject

Returns the value of attribute user_profiles.



9
10
11
# File 'lib/mdex_client/mdata/navigation_query.rb', line 9

def user_profiles
  @user_profiles
end

Instance Method Details

#main_search_queryObject



109
110
111
112
# File 'lib/mdex_client/mdata/navigation_query.rb', line 109

def main_search_query
  @searches ||= {}
  @searches["mainSearch"].try(:query)
end

#main_search_query=(query) ⇒ Object



114
115
116
117
118
119
120
121
# File 'lib/mdex_client/mdata/navigation_query.rb', line 114

def main_search_query=(query)
  @searches ||= {}
  @searches["mainSearch"] ||= Search.new
  @searches["mainSearch"].key = "mainSearch"
  @searches["mainSearch"].query = query
  @searches["mainSearch"].enable_snippeting = true
  @searches["mainSearch"].snippet_length = 100
end

#write_xml!(xml) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mdex_client/mdata/navigation_query.rb', line 16

def write_xml!(xml)
  if selected_dimension_value_ids
    xml.mdata :SelectedDimensionValueIds do
      selected_dimension_value_ids.each do |id|
        xml.mdata :DimensionValueId, id
      end
    end
  end
  
  if refinement_configs || expose_all_refinements
    params = {}
    params["ExposeAllRefinements"] = true if expose_all_refinements
    xml.mdata :RefinementConfigs, params do
      if refinement_configs
        refinement_configs.each do |conf|
          conf.write_xml!(xml)
        end
      end
    end
  end
  
  aggregation_key.try(:write_xml!)
  xml.mdata :RecordOffset, record_offset if record_offset
  xml.mdata :RecordsPerPage, records_per_page if records_per_page
  
  if included_record_attributes
    xml.mdata :IncludedRecordAttributes do
      included_record_attributes.each do |a|
        xml.mdata :IncludedRecordAttribute, a
      end
    end
  end
  
  if sorts
    xml.mdata :Sorts do
      sorts.each do |sort|
        sort.write_xml!(xml)
      end
    end
  end
  
  xml.mdata :BusinessRulesFilter, business_rules_filter if business_rules_filter
  if business_rules_preview_time
    xml.mdata :BusinessRulesPreviewTime, 
      business_rules_preview_time.utc.strftime("%Y-%m-%dT%H:%M:%S")
  end
  
  xml.mdata :EqlExpression, eql_expression if eql_expression
  xml.mdata :RecordFilter, record_filter if record_filter
  
  if range_filters.present?
  	xml.mdata :RangeFilters do
   	range_filters.each do |filter|
   		filter.write_xml!(xml)
   	end
   end
  end
  
  if searches && searches.any? { |key, search| search.query.present? }
    searches_attrs = {}
    searches_attrs["EnableDidYouMean"] = enable_did_you_mean.to_s if enable_did_you_mean
    xml.mdata :Searches, searches_attrs do
      searches.each do |key, search|
        next unless search.query.present?
        search.write_xml!(xml)
      end
    end
  end
end