Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (32 sloc) 0.901 kB
require 'test_helper'
module Tire
class PrefixQueryTest < Test::Unit::TestCase
include Test::Integration
context "Prefix queries" do
should "search by a prefix" do
s = Tire.search('articles-test') do
query do
# "on" => "One"
prefix :title, "on"
end
end
assert_equal 1, s.results.size
assert_equal ['One'], s.results.map(&:title)
end
should "allow to specify boost" do
s = Tire.search('articles-test') do
query do
boolean do
# "on" => "One", boost it
should { prefix :title, "on", :boost => 2.0 }
should { all }
end
end
sort { by :_score }
end
assert_equal 5, s.results.size
assert_equal 'One', s.results.first.title
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.