Skip to content
Browse files

Merge branch 'master' of github.com:nbraem/sunspot

Conflicts:
	sunspot/lib/sunspot/dsl/more_like_this_query.rb
	sunspot/lib/sunspot/dsl/standard_query.rb
	sunspot/lib/sunspot/query/more_like_this.rb
	sunspot/lib/sunspot/type.rb
  • Loading branch information...
2 parents a5b4506 + dac579c commit 55303c5c4b045db2039badae92d82449a0b8dfc6 @nbraem committed Oct 7, 2010
View
2 sunspot/lib/sunspot/dsl/standard_query.rb
@@ -122,7 +122,7 @@ def with(*args)
# Enables explain on hits.
#
def debug(debug_on = true)
- @query.set_debug(debug_on)
+ @query.set_debug(debug_on)
end
end
end
View
18 sunspot/lib/sunspot/search/more_like_this_search.rb
@@ -7,7 +7,7 @@ module Sunspot
#
module Search
class MoreLikeThisSearch < AbstractSearch
- def execute
+ def execute(options={})
if @query.more_like_this.fields.empty?
@setup.all_more_like_this_fields.each do |field|
@query.more_like_this.add_field(field, field.more_like_this_boost)
@@ -36,6 +36,22 @@ def interesting_terms
end
end
+ def interesting_terms
+ if @solr_result['interestingTerms']
+ if @solr_result['interestingTerms'].last.is_a? Float
+ # interestingTerms: ["body_mlt_textv:two", 1.0, "body_mlt_textv:three", 1.0]
+ @interesting_terms ||= @solr_result['interestingTerms'].each_slice(2).map do |interesting_term, score|
+ field, term = interesting_term.match(/(.*)_.+:(.*)/)[1..2]
+ InterestingTerm.new(term, field, score)
+ end
+ else
+ @interesting_terms ||= @solr_result['interestingTerms'].map do |term|
+ InterestingTerm.new(term)
+ end
+ end
+ end
+ end
+
private
# override
View
8 sunspot/solr/solr/conf/schema.xml
@@ -188,6 +188,14 @@
<!-- *** This dynamicField is used by Sunspot! *** -->
<dynamicField name="*_sms" stored="true" type="string" multiValued="true" indexed="true"/>
<!-- *** This dynamicField is used by Sunspot! *** -->
+ <dynamicField name="*_sv" stored="false" type="string" multiValued="false" indexed="true" termVectors="true"/>
+ <!-- *** This dynamicField is used by Sunspot! *** -->
+ <dynamicField name="*_smv" stored="false" type="string" multiValued="true" indexed="true" termVectors="true"/>
+ <!-- *** This dynamicField is used by Sunspot! *** -->
+ <dynamicField name="*_ssv" stored="true" type="string" multiValued="false" indexed="true" termVectors="true"/>
+ <!-- *** This dynamicField is used by Sunspot! *** -->
+ <dynamicField name="*_smsv" stored="true" type="string" multiValued="true" indexed="true" termVectors="true"/>
+ <!-- *** This dynamicField is used by Sunspot! *** -->
<dynamicField name="*_it" stored="false" type="tint" multiValued="false" indexed="true"/>
<!-- *** This dynamicField is used by Sunspot! *** -->
<dynamicField name="*_itm" stored="false" type="tint" multiValued="true" indexed="true"/>

0 comments on commit 55303c5

Please sign in to comment.
Something went wrong with that request. Please try again.