lib/rufus/tokyo/cabinet/table.rb
def search (type, *queries)

      run_query = true
      run_query = queries.pop if queries.last == false

      raise(
        ArgumentError.new("pass at least one prepared query")
      ) if queries.size < 1

      raise(
        ArgumentError.new("pass instances of Rufus::Tokyo::TableQuery only")
      ) if queries.find { |q| q.class != TableQuery }

      t = META_TYPES[type]

      raise(
        ArgumentError.new("no search type #{type.inspect}")
      ) unless t

      qs = FFI::MemoryPointer.new(:pointer, queries.size)
      qs.write_array_of_pointer(queries.collect { |q| q.pointer })

      r = lib.tab_metasearch(qs, queries.size, t)

      qs.free

      pks = Rufus::Tokyo::List.new(r).release

      run_query ? lget(pks) : pks
    end
def search (type, *queries)

      run_query = true
      run_query = queries.pop if queries.last == false

      raise(
        ArgumentError.new("pass at least one prepared query")
      ) if queries.size < 1

      raise(
        ArgumentError.new("pass instances of Rufus::Tokyo::TableQuery only")
      ) if queries.find { |q| q.class != TableQuery }

      t = META_TYPES[type]

      raise(
        ArgumentError.new("no search type #{type.inspect}")
      ) unless t

      qs = FFI::MemoryPointer.new(:pointer, queries.size)
      qs.write_array_of_pointer(queries.collect { |q| q.pointer })

      r = lib.tab_metasearch(qs, queries.size, t)

      qs.free

      pks = Rufus::Tokyo::List.new(r).release

      run_query ? lget(pks) : pks
    end
A #search a la ruby-tokyotyrant
 (http://github.com/actsasflinn/ruby-tokyotyrant/tree)

   r = table.search(
     :intersection,
     @t.prepare_query { |q|
       q.add 'lang', :includes, 'es'
     },
     @t.prepare_query { |q|
       q.add 'lang', :includes, 'li'
     }
   )

 Accepts the symbols :union, :intersection, :difference or :diff as
 first parameter.

 If the last element element passed to this method is the value 'false',
 the return value will the array of matching primary keys.