Sha256: 3d3421eb6311ff4468906b35d273f2803edb87f8ef47ef6c20b66e17b6d9fc52

Contents?: true

Size: 1.49 KB

Versions: 7

Compression:

Stored size: 1.49 KB

Contents

module BlacklightCql::ExplainHelper

  # Arg is a Builder instance. 
  def luke_to_explain_index(xml)    
    @luke_response[:fields].each_pair do |solr_field, defn|
      # only if it's an indexed
      if defn[:schema].include?("I")
        xml.index("search" => "true", "scan"=>false, "sort" => false) do
          xml.title solr_field.to_s
          xml.map do
            xml.name(solr_field.to_s, "set" => CqlRuby.to_solr_defaults[:solr_field_prefix])             
          end
          # What relations do we support for this index?
          xml.configInfo do
            ["==", "=", ">=", ">", "<", "<=", "<>", "within", "adj", "all", "any"].each do |rel|
              xml.supports(rel, "type"=>"relation")
            end                                    
          end
        end
      end    
    end
  end

  # Expects @config to have a Blacklight::Configuration
  # object. 
  def blacklight_config_to_explain_index(xml)
    @config.search_fields.values.each do |search_field|
      xml.index("search" => "true", "scan" => "false", "sort" => "false") do
        xml.title search_field[:label]
        xml.map do
          xml.name(search_field[:key], "set" => CqlRuby.to_solr_defaults[:blacklight_field_prefix]) 
        end
        # What relations do we support for this index? Right now,
        # just the custom solr.dismax one
        xml.configInfo do
          xml.supports("=", "type"=>"relation")
          xml.supports("solr.dismax", "type"=>"relation")
        end
      end
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
blacklight_cql-3.0.1 app/helpers/blacklight_cql/explain_helper.rb
blacklight_cql-3.0.0 app/helpers/blacklight_cql/explain_helper.rb
blacklight_cql-2.0.1 app/helpers/blacklight_cql/explain_helper.rb
blacklight_cql-2.0.0 app/helpers/blacklight_cql/explain_helper.rb
blacklight_cql-1.2.1 app/helpers/blacklight_cql/explain_helper.rb
blacklight_cql-1.2.0 app/helpers/blacklight_cql/explain_helper.rb
blacklight_cql-1.1.0 app/helpers/blacklight_cql/explain_helper.rb