Sha256: 28feeebdd13b923edd3b8b370ca33906edcb221ec7efa08e2afc65e4df154126

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

#!/usr/bin/env ruby

require 'fileutils'
require 'groonga'

Groonga::Logger.log_path = "/tmp/groonga.log" 
Groonga::Logger.query_log_path = "/tmp/groonga-query.log" 

i = 0
loop do
  path = "/tmp/db/db" 
  FileUtils.rm_rf(File.dirname(path))
  FileUtils.mkdir_p(File.dirname(path))
  Groonga::Context.default = nil
  database = Groonga::Database.create(:path => path)
  Groonga::Schema.define do |schema|
    schema.create_table("Users",
                        :type => :hash,
                        :key_type => "ShortText") do |table|
      table.uint32("name_length")
    end
  end

  users = Groonga["Users"]
  10.times do
    i += 1
    exit if i > 100
    name = i.to_s
    users.add(name, :name_length => name.length)
  end
  builder = Groonga::RecordExpressionBuilder.new(users, nil)
  builder.query = "name_length:3" 
  builder.build
  database.close
  GC.start
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rroonga-2.0.0 bug.rb
rroonga-1.2.4 bug.rb