Sha256: 4b80a044dd5319fcbeb5be54cec1d131244fe3404e899538412f5baa64fff25c
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "blacklight_to_solr" do before do @config = Class.new do include Blacklight::SearchFields def config { :search_fields => [ { :display_label => "Title", :key => "title", :solr_parameters => { :qf => "ti_something" }, :solr_local_parameters => { :pf => "$ti_something" } }, { :display_label => "Author", :key => "author", :solr_parameters => { :qf => "au_something^10 au_else^100" } } ] } end end.new @parser = CqlRuby::CqlParser.new end it "should convert to nested queries with local dismax param definitions" do output = @parser.parse('title = "foo +bar" AND author = smith OR some_solr_field = frog').to_bl_solr(@config) output.should == "( ( _query_:\"{!dismax qf=ti_something pf=$ti_something} foo +bar \" AND _query_:\"{!dismax qf='au_something^10 au_else^100'} smith \" ) OR some_solr_field:frog )" end it "should use default BL config'd search for solr.dismax or '=' relation" do output = @parser.parse("cql.serverChoice solr.dismax \"foo bar\"").to_bl_solr(@config) output.should == " _query_:\"{!dismax qf=ti_something pf=$ti_something} foo bar \" " end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blacklight_cql-0.9.1 | spec/blacklight_to_solr_spec.rb |
blacklight_cql-0.9.0 | spec/blacklight_to_solr_spec.rb |