Commit 517899062f89d20a977a7a77d86588695656623a

Authored by Braulio Bhavamitra
1 parent f375a395

Don't change user's string

This lead to a problem with a facet query that is ran two times
vendor/plugins/acts_as_solr_reloaded/lib/acts_as_solr/parser_methods.rb
@@ -35,7 +35,7 @@ module ActsAsSolr #:nodoc: @@ -35,7 +35,7 @@ module ActsAsSolr #:nodoc:
35 query = add_relevance query, options[:relevance] 35 query = add_relevance query, options[:relevance]
36 36
37 raise "Expecting and array of strings for :filter_queries" unless options[:filter_queries].nil? or options[:filter_queries].kind_of?(Array) 37 raise "Expecting and array of strings for :filter_queries" unless options[:filter_queries].nil? or options[:filter_queries].kind_of?(Array)
38 - query_options[:filter_queries] = replace_types([*options[:filter_queries]].collect{|k| "#{k.sub!(/ *: */,"_t:")}"}) if options[:filter_queries] 38 + query_options[:filter_queries] = replace_types([*options[:filter_queries]].collect{|k| "#{k.dup.sub!(/ *: */,"_t:")}"}) if options[:filter_queries]
39 39
40 # first steps on the facet parameter processing 40 # first steps on the facet parameter processing
41 if options[:facets] 41 if options[:facets]
@@ -47,8 +47,8 @@ module ActsAsSolr #:nodoc: @@ -47,8 +47,8 @@ module ActsAsSolr #:nodoc:
47 # override the :zeros (it's deprecated anyway) if :mincount exists 47 # override the :zeros (it's deprecated anyway) if :mincount exists
48 query_options[:facets][:mincount] = options[:facets][:mincount] if options[:facets][:mincount] 48 query_options[:facets][:mincount] = options[:facets][:mincount] if options[:facets][:mincount]
49 query_options[:facets][:fields] = options[:facets][:fields].collect{|k| "#{k}_facet"} if options[:facets][:fields] 49 query_options[:facets][:fields] = options[:facets][:fields].collect{|k| "#{k}_facet"} if options[:facets][:fields]
50 - query_options[:filter_queries] += replace_types([*options[:facets][:browse]].collect{|k| "#{k.sub!(/ *: */,"_t:")}"}) if options[:facets][:browse]  
51 - query_options[:facets][:queries] = replace_types(options[:facets][:query].collect{|k| "#{k.sub!(/ *: */,"_t:")}"}) if options[:facets][:query] 50 + query_options[:filter_queries] += replace_types([*options[:facets][:browse]].collect{|k| "#{k.dup.sub!(/ *: */,"_t:")}"}) if options[:facets][:browse]
  51 + query_options[:facets][:queries] = replace_types(options[:facets][:query].collect{|k| "#{k.dup.sub!(/ *: */,"_t:")}"}) if options[:facets][:query]
52 52
53 53
54 if options[:facets][:dates] 54 if options[:facets][:dates]
@@ -72,7 +72,7 @@ module ActsAsSolr #:nodoc: @@ -72,7 +72,7 @@ module ActsAsSolr #:nodoc:
72 query_options[:date_facets][:end] = options[:facets][:dates][:end] if options[:facets][:dates][:end] 72 query_options[:date_facets][:end] = options[:facets][:dates][:end] if options[:facets][:dates][:end]
73 query_options[:date_facets][:gap] = options[:facets][:dates][:gap] if options[:facets][:dates][:gap] 73 query_options[:date_facets][:gap] = options[:facets][:dates][:gap] if options[:facets][:dates][:gap]
74 query_options[:date_facets][:hardend] = options[:facets][:dates][:hardend] if options[:facets][:dates][:hardend] 74 query_options[:date_facets][:hardend] = options[:facets][:dates][:hardend] if options[:facets][:dates][:hardend]
75 - query_options[:date_facets][:filter] = replace_types([*options[:facets][:dates][:filter]].collect{|k| "#{k.sub!(/ *:(?!\d) */,"_d:")}"}) if options[:facets][:dates][:filter] 75 + query_options[:date_facets][:filter] = replace_types([*options[:facets][:dates][:filter]].collect{|k| "#{k.dup.sub!(/ *:(?!\d) */,"_d:")}"}) if options[:facets][:dates][:filter]
76 76
77 if options[:facets][:dates][:other] 77 if options[:facets][:dates][:other]
78 validate_date_facet_other_options(options[:facets][:dates][:other]) 78 validate_date_facet_other_options(options[:facets][:dates][:other])