Sha256: 6d6917de956f11063c72a29dbe04a8d27c2c861133170508086460b59c1ba7b5

Contents?: true

Size: 1.39 KB

Versions: 42

Compression:

Stored size: 1.39 KB

Contents

require File.expand_path('spec_helper', File.dirname(__FILE__))

describe 'indexing fulltext fields' do
  it 'indexes text field' do
    session.index(post(:title => 'A Title'))
    connection.should have_add_with(:title_text => 'A Title')
  end

  it 'indexes stored text field' do
    session.index(post(:body => 'Test body'))
    connection.should have_add_with(:body_textsv => 'Test body')
  end

  it 'indexes text field with boost' do
    session.index(post(:title => 'A Title'))
    connection.adds.last.first.field_by_name(:title_text).attrs[:boost].should == 2
  end

  it 'indexes multiple values for a text field' do
    session.index(post(:body => %w(some title)))
    connection.should have_add_with(:body_textsv => %w(some title))
  end

  it 'indexes text via a block accessor' do
    session.index(post(:title => 'backwards'))
    connection.should have_add_with(:backwards_title_text => 'sdrawkcab')
  end

  it 'indexes document level boost using block' do
    session.index(post(:ratings_average => 4.0))
    connection.adds.last.first.attrs[:boost].should == 1.25
  end

  it 'indexes document level boost using attribute' do
    session.index(Namespaced::Comment.new(:boost => 1.5))
    connection.adds.last.first.attrs[:boost].should == 1.5
  end

  it 'indexes document level boost defined statically' do
    session.index(Photo.new)
    connection.adds.last.first.attrs[:boost].should == 0.75
  end
end

Version data entries

42 entries across 42 versions & 10 rubygems

Version Path
sunspot-2.0.0.pre.120720 spec/api/indexer/fulltext_spec.rb
sunspot-1.3.3 spec/api/indexer/fulltext_spec.rb
sunspot-1.3.2 spec/api/indexer/fulltext_spec.rb
sunspot-2.0.0.pre.120417 spec/api/indexer/fulltext_spec.rb
sunspot-2.0.0.pre.120415 spec/api/indexer/fulltext_spec.rb
sunspot-1.3.1 spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-2.0.0.pre.111215d spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-2.0.0.pre.111215c spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-2.0.0.pre.111215b spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-2.0.0.pre.111215a spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-2.0.0.pre.111215 spec/api/indexer/fulltext_spec.rb
sunspot-2.0.0.pre.111215 spec/api/indexer/fulltext_spec.rb
cb_sunspot-2.0.0.pre.5 spec/api/indexer/fulltext_spec.rb
cb_sunspot-2.0.0.pre.3 spec/api/indexer/fulltext_spec.rb
cb_sunspot-2.0.0.pre3 spec/api/indexer/fulltext_spec.rb
sunspot-1.3.0 spec/api/indexer/fulltext_spec.rb
pduey-sunspot-1.2.1.1 spec/api/indexer/fulltext_spec.rb
sunspot-1.3.0.rc6 spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-1.2.1 spec/api/indexer/fulltext_spec.rb
lisausa-sunspot-1.2.1 spec/api/indexer/fulltext_spec.rb