Sha256: b43b0cc2bd703984261854e5cefa7417aeb02b6d322c86eb65bcab0a59d80b10

Contents?: true

Size: 1.39 KB

Versions: 14

Compression:

Stored size: 1.39 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_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

14 entries across 14 versions & 5 rubygems

Version Path
erichummel-sunspot-1.2.1g spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-1.2.1f spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-1.2.1b spec/api/indexer/fulltext_spec.rb
erichummel-sunspot-1.2.1a spec/api/indexer/fulltext_spec.rb
lisausa-sunspot-1.2.1.1 spec/api/indexer/fulltext_spec.rb
ruben-sunspot-1.1.4 spec/api/indexer/fulltext_spec.rb
ruben-sunspot-1.1.3 spec/api/indexer/fulltext_spec.rb
ruben-sunspot-1.1.2 spec/api/indexer/fulltext_spec.rb
sunspot-1.2.1 spec/api/indexer/fulltext_spec.rb
sunspot-1.2.0 spec/api/indexer/fulltext_spec.rb
ruben-sunspot-1.1.1 spec/api/indexer/fulltext_spec.rb
ruben-sunspot-1.1.0 spec/api/indexer/fulltext_spec.rb
nuatt_sunspot-1.1.0.3 spec/api/indexer/fulltext_spec.rb
sunspot-1.1.0 spec/api/indexer/fulltext_spec.rb