Skip to content

Commit 910f071

Browse files
committed
similarity filter
Signed-off-by: usamoi <usamoi@outlook.com>
1 parent a191d66 commit 910f071

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed

src/vectorchord/usage/similarity-filter.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,169 @@ Refer to
4949

5050
* [Operator Classes (`vchordrq`)](indexing#operator-classes).
5151
* [Operator Classes (`vchordg`)](graph-index#operator-classes).
52+
53+
### Types
54+
55+
#### `sphere_vector`
56+
57+
- Description: A sphere.
58+
- Definition: `(center halfvec, radius REAL)`.
59+
60+
#### `sphere_halfvec`
61+
62+
- Description: A sphere.
63+
- Definition: `(center halfvec, radius REAL)`.
64+
65+
#### `sphere_rabitq8` <badge type="tip" text="since v1.1.0" />
66+
67+
- Description: A sphere.
68+
- Definition: `(center rabitq8, radius REAL)`.
69+
70+
#### `sphere_rabitq4` <badge type="tip" text="since v1.1.0" />
71+
72+
- Description: A sphere.
73+
- Definition: `(center rabitq4, radius REAL)`.
74+
75+
### Functions
76+
77+
#### `sphere(vector, real)`
78+
79+
- Description: Create a sphere by its center and radius.
80+
- Definition: `SELECT ROW($1, $2)`.
81+
- Result: `sphere_vector`
82+
- Arguments:
83+
- `vector`, the center of the sphere
84+
- `real`, the radius of sphere
85+
- Example:
86+
- `SELECT sphere('[0,0,0]'::vector, 1.0)`
87+
88+
#### `sphere(halfvec, real)`
89+
90+
- Description: Create a sphere by its center and radius.
91+
- Definition: `SELECT ROW($1, $2)`.
92+
- Result: `sphere_halfvec`
93+
- Arguments:
94+
- `halfvec`, the center of the sphere
95+
- `real`, the radius of sphere
96+
- Example:
97+
- `SELECT sphere('[0,0,0]'::halfvec, 1.0)`
98+
99+
#### `sphere(rabitq8, real)` <badge type="tip" text="since v1.1.0" />
100+
101+
- Description: Create a sphere by its center and radius.
102+
- Definition: `SELECT ROW($1, $2)`.
103+
- Result: `sphere_rabitq8`
104+
- Arguments:
105+
- `rabitq8`, the center of the sphere
106+
- `real`, the radius of sphere
107+
- Example:
108+
- `SELECT sphere(quantize_to_scalar8('[0,0,0]'::vector), 1.0)`
109+
110+
#### `sphere(rabitq4, real)` <badge type="tip" text="since v1.1.0" />
111+
112+
- Description: Create a sphere by its center and radius.
113+
- Definition: `SELECT ROW($1, $2)`.
114+
- Result: `sphere_rabitq4`
115+
- Arguments:
116+
- `rabitq4`, the center of the sphere
117+
- `real`, the radius of sphere
118+
- Example:
119+
- `SELECT sphere(quantize_to_scalar4('[0,0,0]'::vector), 1.0)`
120+
121+
### Operators
122+
123+
#### `<<->>(vector, sphere_vector)`
124+
125+
- Description: Test if the vector lies inside the sphere using the L2 metric.
126+
- Result: boolean
127+
- Arguments:
128+
- `vector`, the vector to be tested
129+
- `sphere_vector`, the sphere
130+
131+
#### `<<#>>(vector, sphere_vector)`
132+
133+
- Description: Test if the vector lies inside the sphere using the negative dot product metric.
134+
- Result: boolean
135+
- Arguments:
136+
- `vector`, the vector to be tested
137+
- `sphere_vector`, the sphere
138+
139+
#### `<<=>>(vector, sphere_vector)`
140+
141+
- Description: Test if the vector lies inside the sphere using the cosine metric.
142+
- Result: boolean
143+
- Arguments:
144+
- `vector`, the vector to be tested
145+
- `sphere_vector`, the sphere
146+
147+
#### `<<->>(halfvec, sphere_halfvec)`
148+
149+
- Description: Test if the vector lies inside the sphere using the L2 metric.
150+
- Result: boolean
151+
- Arguments:
152+
- `halfvec`, the vector to be tested
153+
- `sphere_halfvec`, the sphere
154+
155+
#### `<<#>>(halfvec, sphere_halfvec)`
156+
157+
- Description: Test if the vector lies inside the sphere using the negative dot product metric.
158+
- Result: boolean
159+
- Arguments:
160+
- `halfvec`, the vector to be tested
161+
- `sphere_halfvec`, the sphere
162+
163+
#### `<<=>>(halfvec, sphere_halfvec)`
164+
165+
- Description: Test if the vector lies inside the sphere using the cosine metric.
166+
- Result: boolean
167+
- Arguments:
168+
- `halfvec`, the vector to be tested
169+
- `sphere_halfvec`, the sphere
170+
171+
#### `<<->>(rabitq8, sphere_rabitq8)` <badge type="tip" text="since v1.1.0" />
172+
173+
- Description: Test if the vector lies inside the sphere using the L2 metric.
174+
- Result: boolean
175+
- Arguments:
176+
- `rabitq8`, the vector to be tested
177+
- `sphere_rabitq8`, the sphere
178+
179+
#### `<<#>>(rabitq8, sphere_rabitq8)` <badge type="tip" text="since v1.1.0" />
180+
181+
- Description: Test if the vector lies inside the sphere using the negative dot product metric.
182+
- Result: boolean
183+
- Arguments:
184+
- `rabitq8`, the vector to be tested
185+
- `sphere_rabitq8`, the sphere
186+
187+
#### `<<=>>(rabitq8, sphere_rabitq8)` <badge type="tip" text="since v1.1.0" />
188+
189+
- Description: Test if the vector lies inside the sphere using the cosine metric.
190+
- Result: boolean
191+
- Arguments:
192+
- `rabitq8`, the vector to be tested
193+
- `sphere_rabitq8`, the sphere
194+
195+
#### `<<->>(rabitq4, sphere_rabitq4)` <badge type="tip" text="since v1.1.0" />
196+
197+
- Description: Test if the vector lies inside the sphere using the L2 metric.
198+
- Result: boolean
199+
- Arguments:
200+
- `rabitq4`, the vector to be tested
201+
- `sphere_rabitq4`, the sphere
202+
203+
#### `<<#>>(rabitq4, sphere_rabitq4)` <badge type="tip" text="since v1.1.0" />
204+
205+
- Description: Test if the vector lies inside the sphere using the negative dot product metric.
206+
- Result: boolean
207+
- Arguments:
208+
- `rabitq4`, the vector to be tested
209+
- `sphere_rabitq4`, the sphere
210+
211+
#### `<<=>>(rabitq4, sphere_rabitq4)` <badge type="tip" text="since v1.1.0" />
212+
213+
- Description: Test if the vector lies inside the sphere using the cosine metric.
214+
- Result: boolean
215+
- Arguments:
216+
- `rabitq4`, the vector to be tested
217+
- `sphere_rabitq4`, the sphere

0 commit comments

Comments
 (0)