Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (33 sloc) 1.059 kB
require 'test_helper'
module Tire
class ExplanationIntegrationTest < Test::Unit::TestCase
include Test::Integration
context "Explanation" do
teardown { Tire.index('explanation-test').delete }
setup do
content = "A Fox one day fell into a deep well and could find no means of escape."
Tire.index 'explanation-test' do
delete
create
store :id => 1, :content => content
refresh
end
end
should "add '_explanation' field to the result item" do
# Tire::Configuration.logger STDERR, :level => 'debug'
s = Tire.search 'explanation-test', :explain => true do
query do
boolean do
should { string 'content:Fox' }
end
end
end
doc = s.results.first
explanation = doc._explanation
assert explanation.description.include?("product of:")
assert explanation.value < 0.6
assert_not_nil explanation.details
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.