Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

+ 4.17.1, ! for when no tokenizer is available for a category, + spec…

…s for that specific bug
  • Loading branch information...
commit 6e3ffe6c4a4ae2c560c4ebff72fe8ec75ad6d19b 1 parent 85fd8cb
@floere authored
View
6 CHANGELOG.md
@@ -1,3 +1,9 @@
+## 4.17.1
+
+###### [Server](https://github.com/floere/picky/tree/master/server)
+
+- Fix for parallel tokenizing when option `tokenize` is set to false on a category.
+
## 4.17.0
###### [Server](https://github.com/floere/picky/tree/master/server)
View
2  server/lib/picky/indexers/parallel.rb
@@ -19,7 +19,7 @@ def process source_for_prepare, categories, scheduler = Scheduler.new
# Prepare a combined object - array.
#
combined = categories.map do |category|
- [category, category.prepared_index_file, [], (category.tokenizer || tokenizer)]
+ [category, category.prepared_index_file, [], category.tokenizer]
end
# Go through each object in the source.
View
81 server/spec/lib/indexers/parallel_spec.rb
@@ -1,28 +1,83 @@
require 'spec_helper'
describe Picky::Indexers::Parallel do
+
+ thing = Struct.new :id, :text
before(:each) do
- @source = stub :source
- @index = stub :index, :name => :some_index, :source => @source
-
- @categories = stub :categories
-
+ @index = Picky::Index.new(:test) # stub :index, :name => :some_index, :source => @source, :backend => stub(:backend)
@indexer = described_class.new @index
@indexer.stub! :timed_exclaim
end
+
+ context 'with untokenized category' do
+
+ before(:each) do
+ @categories = [
+ Picky::Category.new(:text, @index)
+ ]
+ @source = [
+ thing.new(1, "hello"),
+ thing.new(2, "world"),
+ ]
+ end
- describe 'flush' do
- it 'flushes to joined cache to the file and clears it' do
- cache = stub :cache
- file = stub :file
+ describe 'flush' do
+ it 'flushes to joined cache to the file and clears it' do
+ cache = stub :cache
+ file = stub :file
- cache.should_receive(:join).once.and_return :joined
- file.should_receive(:write).once.with(:joined).and_return :joined
- cache.should_receive(:clear).once
+ cache.should_receive(:join).once.and_return :joined
+ file.should_receive(:write).once.with(:joined).and_return :joined
+ cache.should_receive(:clear).once
- @indexer.flush file, cache
+ @indexer.flush file, cache
+ end
+ end
+
+ describe 'process' do
+ it 'flushes to joined cache to the file and clears it' do
+ @indexer.process @source, @categories do |file|
+ file.path.should == 'spec/temp/index/test/test/text.prepared.txt'
+ end
+ end
+ end
+
+ end
+
+ context 'with tokenized category' do
+
+ before(:each) do
+ @categories = [
+ Picky::Category.new(:text, @index, tokenize: false)
+ ]
+ @source = [
+ thing.new(1, ["hello"]),
+ thing.new(2, ["world"]),
+ ]
+ end
+
+ describe 'flush' do
+ it 'flushes to joined cache to the file and clears it' do
+ cache = stub :cache
+ file = stub :file
+
+ cache.should_receive(:join).once.and_return :joined
+ file.should_receive(:write).once.with(:joined).and_return :joined
+ cache.should_receive(:clear).once
+
+ @indexer.flush file, cache
+ end
+ end
+
+ describe 'process' do
+ it 'flushes to joined cache to the file and clears it' do
+ @indexer.process @source, @categories do |file|
+ file.path.should == 'spec/temp/index/test/test/text.prepared.txt'
+ end
+ end
end
+
end
end
View
2  version.rb
@@ -1,3 +1,3 @@
module Picky
- VERSION = '4.17.0'
+ VERSION = '4.17.1'
end
Please sign in to comment.
Something went wrong with that request. Please try again.