poliqarpr 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/changelog.txt CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.9
2
+ - Change the default buffer size to 5000
3
+ - Fix buffer resize
4
+
1
5
  0.1.8
2
6
  - fix subsequent single result queries
3
7
  - always cancel previous job before starting a new one
@@ -26,7 +26,7 @@ module Poliqarp
26
26
  @debug = debug
27
27
  @logger = STDOUT
28
28
  @connector = Connector.new(self)
29
- @config = Config.new(self,500000)
29
+ @config = Config.new(self,5000)
30
30
  @answer_queue = Queue.new
31
31
  @waiting_mutex = Mutex.new
32
32
  @query_mutex = Mutex.new
@@ -54,7 +54,7 @@ module Poliqarp
54
54
  close if @session
55
55
  @connector.open("localhost",port)
56
56
  talk("MAKE-SESSION #{@session_name}")
57
- talk("BUFFER-RESIZE #{config.buffer_size}")
57
+ resize_buffer(config.buffer_size)
58
58
  @session = true
59
59
  end
60
60
 
@@ -228,7 +228,13 @@ module Poliqarp
228
228
  result
229
229
  end
230
230
 
231
- protected
231
+ protected
232
+
233
+ # Resizes the result buffer.
234
+ def resize_buffer(size)
235
+ talk("BUFFER-RESIZE #{size}")
236
+ end
237
+
232
238
  # Set the size of the left context.
233
239
  def left_context=(value)
234
240
  result = talk("SET left-context-width #{value}")
@@ -8,13 +8,20 @@ module Poliqarp
8
8
  GROUPS = [:left_context, :left_match, :right_match, :right_context]
9
9
  # The size of the buffer is the maximum number of excerpts which
10
10
  # are returned for single query.
11
- attr_accessor :buffer_size, :left_context_size, :right_context_size, :tags, :lemmata
11
+ attr_reader :buffer_size
12
+ attr_accessor :left_context_size, :right_context_size, :tags, :lemmata
12
13
 
13
14
  def initialize(client,buffer_size)
14
15
  @client = client
15
16
  @buffer_size = buffer_size
16
17
  end
17
18
 
19
+ # Sets the result buffer size.
20
+ def buffer_size=(size)
21
+ @buffer_size = size
22
+ @client.send(:resize_buffer,size)
23
+ end
24
+
18
25
  # Sets the size of the left short context. It must be > 0
19
26
  #
20
27
  # The size of the left short context is the number
data/poliqarpr.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "poliqarpr"
3
- s.version = "0.1.8"
3
+ s.version = "0.1.9"
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
  s.summary = "Ruby client for Poliqarp"
6
6
  s.email = "apohllo@o2.pl"
data/spec/client.rb CHANGED
@@ -66,6 +66,12 @@ describe Poliqarp::Client do
66
66
  @client.close
67
67
  end
68
68
 
69
+ it "should resize the result buffer" do
70
+ # the size of the buffer is 5000 by default
71
+ @client.config.buffer_size = 5010
72
+ @client.find("a").size.should == 5010
73
+ end
74
+
69
75
  it "should allow to set and get the right context size" do
70
76
  @client.config.right_context_size = 5
71
77
  @client.config.right_context_size.should == 5
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: poliqarpr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.8
5
+ version: 0.1.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Aleksander Pohl
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-08 00:00:00 +01:00
13
+ date: 2011-03-10 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies: []
16
16