spec/functional/facets_spec.rb in picky-4.6.1 vs spec/functional/facets_spec.rb in picky-4.6.2
- old
+ new
@@ -7,11 +7,11 @@
describe 'facets' do
describe 'simple example' do
let(:index) {
index = Picky::Index.new :facets do
- category :name
+ category :name, partial: Picky::Partial::Substring.new(from: 1)
category :surname
end
thing = Struct.new :id, :name, :surname
index.add thing.new(1, 'fritz', 'hanke')
@@ -64,9 +64,16 @@
}
# It only uses exact matches (ie. the last token is not partialized).
#
finder.facets(:name, filter: 'surname:hank').should == {}
+
+ # It allows explicit partial matches.
+ #
+ finder.facets(:name, filter: 'surname:hank*').should == {
+ 'fritz' => 1,
+ 'florian' => 1
+ }
# It allows explicit partial matches.
#
finder.facets(:name, filter: 'surname:hank*').should == {
'fritz' => 1,