Solr full-text queries use Solr’s JoinRequestHandler.
Add a boost function
# File lib/sunspot/query/join.rb, line 63 def add_boost_function(function_query) end
Add a fulltext field to be searched, with optional boost.
# File lib/sunspot/query/join.rb, line 69 def add_fulltext_field(field, boost = nil) super if field.is_a?(Sunspot::JoinField) && field.target == @target && field.from == @from && field.to == @to end
Set highlighting options for the query. If fields is empty, the Highlighting object won’t pass field names at all, which means the dismax’s :qf parameter will be used by Solr.
# File lib/sunspot/query/join.rb, line 85 def add_highlight(fields=[], options={}) end
Add a phrase field for extra boost.
# File lib/sunspot/query/join.rb, line 77 def add_phrase_field(field, boost = nil) end
Assign a new boost query and return it.
# File lib/sunspot/query/join.rb, line 57 def create_boost_query(factor) end
The query as Solr parameters
# File lib/sunspot/query/join.rb, line 24 def to_params params = { :q => @keywords } params[:fl] = '* score' params[:qf] = @fulltext_fields.values.map { |field| field.to_boosted_field }.join(' ') params[:defType] = 'join' params[:mm] = @minimum_match if @minimum_match params end
Serialize the query as a Solr nested subquery.
# File lib/sunspot/query/join.rb, line 37 def to_subquery params = self.to_params params.delete :defType params.delete :fl keywords = escape_quotes(params.delete(:q)) options = params.map { |key, value| escape_param(key, value) }.join(' ') q_name = "q#{@target.name}#{self.object_id}" fq_name = "f#{q_name}" { :q => "_query_:\"{!join from=#{@from} to=#{@to} v=$#{q_name} fq=$#{fq_name}}\"", q_name => "_query_:\"{!edismax #{options}}#{keywords}\"", fq_name => "type:#{@target.name}" } end
# File lib/sunspot/query/join.rb, line 10 def initialize(keywords, target, from, to) @keywords = keywords @target = target @from = from @to = to @fulltext_fields = {} @minimum_match = nil end