Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (24 sloc) 0.776 kB
require File.expand_path '../../../server/lib/picky', __FILE__
Person = Struct.new :id, :first, :last
# We want to search 2 indexes at once.
# One index uses a source, the indexes at realtime.
#
source = Picky::Index.new :people_from_source do
source do
[Person.new(1, 'Donald', 'Knuth'),
Person.new(2, 'Niklaus', 'Wirth')]
end
category :first
category :last
end
source.reindex
realtime = Picky::Index.new :people_with_realtime do
category :first
category :last
end
realtime.replace Person.new(3, 'Donald', 'Worth')
realtime.replace Person.new(4, 'Peter', 'Niklaus')
people = Picky::Search.new source, realtime # <= We pass the search both indexes.
results = people.search 'donald'
# p results.allocations
fail __FILE__ unless results.ids == [1, 3]
Jump to Line
Something went wrong with that request. Please try again.