zvec 0.0.1 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +20 -10
- data/ext/CMakeLists.txt +133 -91
- data/ext/build/macos-debug/CMakeCache.txt +135 -2
- data/ext/build/macos-debug/CMakeFiles/InstallScripts.json +1 -66
- data/ext/build/macos-debug/CMakeFiles/TargetDirectories.txt +0 -844
- data/ext/build/macos-debug/compile_commands.json +8 -8414
- data/lib/zvec/collection.rb +5 -5
- data/lib/zvec/doc.rb +5 -1
- data/lib/zvec/version.rb +3 -1
- data/lib/zvec.rb +18 -7
- metadata +9 -3
data/lib/zvec/collection.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Zvec
|
|
2
4
|
module CollectionConvenience
|
|
3
5
|
# Convenience: build a VectorQuery and execute it
|
|
@@ -22,10 +24,8 @@ module Zvec
|
|
|
22
24
|
# Block-form open: yields the collection and flushes on block exit
|
|
23
25
|
def self.open_collection(path, options: nil)
|
|
24
26
|
col = Collection.open(path, options)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
col.flush
|
|
29
|
-
end
|
|
27
|
+
yield col
|
|
28
|
+
ensure
|
|
29
|
+
col&.flush
|
|
30
30
|
end
|
|
31
31
|
end
|
data/lib/zvec/doc.rb
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Zvec
|
|
2
4
|
class Doc
|
|
3
|
-
# Convert doc fields to a Ruby Hash
|
|
5
|
+
# Convert doc fields to a Ruby Hash. The schema parameter is required because
|
|
6
|
+
# the C++ layer stores fields as type-erased values — the FieldSchema's data_type
|
|
7
|
+
# selects the correct deserialization path (get_field dispatches on it).
|
|
4
8
|
def to_h(schema)
|
|
5
9
|
result = {"pk" => pk, "score" => score}
|
|
6
10
|
field_names.each do |name|
|
data/lib/zvec/version.rb
CHANGED
data/lib/zvec.rb
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative "zvec/version"
|
|
2
4
|
require "zvec_ext"
|
|
3
5
|
require_relative "zvec/collection"
|
|
4
6
|
require_relative "zvec/doc"
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
module Zvec
|
|
9
|
+
# Rice wraps shared_ptr<Collection> as Std::SharedPtr<zvec::Collection>,
|
|
10
|
+
# a proxy class that delegates C++ methods via method_missing. Ruby
|
|
11
|
+
# convenience methods must be included into this wrapper class, not
|
|
12
|
+
# Zvec::Collection itself. We cannot use const_get because the wrapper
|
|
13
|
+
# class name contains C++ mangled type parameters (e.g. angle brackets).
|
|
14
|
+
def self.patch_shared_ptr_wrapper!
|
|
15
|
+
ObjectSpace.each_object(Class) do |klass|
|
|
16
|
+
if klass.name&.start_with?("Std::SharedPtr") && klass.name&.include?("Collection")
|
|
17
|
+
klass.include(Zvec::CollectionConvenience)
|
|
18
|
+
return klass
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
nil
|
|
13
22
|
end
|
|
14
23
|
end
|
|
24
|
+
|
|
25
|
+
Zvec.patch_shared_ptr_wrapper!
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zvec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -38539,6 +38539,12 @@ metadata:
|
|
|
38539
38539
|
homepage_uri: https://github.com/MadBomber/zvec
|
|
38540
38540
|
source_code_uri: https://github.com/MadBomber/zvec
|
|
38541
38541
|
changelog_uri: https://github.com/MadBomber/zvec/blob/main/CHANGELOG.md
|
|
38542
|
+
post_install_message: |
|
|
38543
|
+
zvec installed successfully!
|
|
38544
|
+
|
|
38545
|
+
Tip: For faster future installs, pre-build the C++ library with Homebrew:
|
|
38546
|
+
brew tap madbomber/zvec https://github.com/MadBomber/zvec-ruby.git
|
|
38547
|
+
brew install madbomber/zvec/zvec
|
|
38542
38548
|
rdoc_options: []
|
|
38543
38549
|
require_paths:
|
|
38544
38550
|
- lib
|
|
@@ -38546,14 +38552,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
38546
38552
|
requirements:
|
|
38547
38553
|
- - ">="
|
|
38548
38554
|
- !ruby/object:Gem::Version
|
|
38549
|
-
version:
|
|
38555
|
+
version: '4.0'
|
|
38550
38556
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38551
38557
|
requirements:
|
|
38552
38558
|
- - ">="
|
|
38553
38559
|
- !ruby/object:Gem::Version
|
|
38554
38560
|
version: '0'
|
|
38555
38561
|
requirements: []
|
|
38556
|
-
rubygems_version: 4.0.
|
|
38562
|
+
rubygems_version: 4.0.7
|
|
38557
38563
|
specification_version: 4
|
|
38558
38564
|
summary: EXPERIMENTAL - DO NOT INSTALL - Ruby bindings for Alibaba zvec vector database
|
|
38559
38565
|
test_files: []
|