Sha256: fc325a2d6b51f046d4c518d6a6c1405ede7807b70050a80e48ea7b2d5ec26bab

Contents?: true

Size: 1.38 KB

Versions: 20

Compression:

Stored size: 1.38 KB

Contents

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

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_texts => '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_texts => %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

20 entries across 20 versions & 4 rubygems

Version Path
benjaminkrause-sunspot-0.9.7 spec/api/indexer/fulltext_spec.rb
benjaminkrause-sunspot-0.9.8 spec/api/indexer/fulltext_spec.rb
sunspot-1.0.5 spec/api/indexer/fulltext_spec.rb
sunspot-1.0.4 spec/api/indexer/fulltext_spec.rb
sunspot-1.0.3 spec/api/indexer/fulltext_spec.rb
sunspot-1.0.2 spec/api/indexer/fulltext_spec.rb
sunspot-1.0.1 spec/api/indexer/fulltext_spec.rb
sunspot-1.0.0 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.9 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.8 spec/api/indexer/fulltext_spec.rb
nxa-sunspot-0.10.7 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.7 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.6 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.5 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.4 spec/api/indexer/fulltext_spec.rb
kuahyeow-sunspot-0.10.3 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.3 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.2 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.1 spec/api/indexer/fulltext_spec.rb
sunspot-0.10.0 spec/api/indexer/fulltext_spec.rb