Commit 806d6be
committed
bug #856 [Store] Fix CacheStore and InMemoryStore to return similarity scores (camilleislasse)
This PR was squashed before being merged into the main branch.
Discussion
----------
[Store] Fix CacheStore and InMemoryStore to return similarity scores
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Docs? | no
| Issues | n/a
| License | MIT
## Description
The `DistanceCalculator` was calculating distances but not returning them in the `VectorDocument` results. This meant queries to `CacheStore` and `InMemoryStore` returned
documents without score information, making it impossible to determine result relevance.
## Changes
This fix creates new `VectorDocument` instances with the calculated distance as the `score` property, matching the pattern used by other stores (Redis, MariaDb, Postgres).
Commits
-------
65e85c3 [Store] Fix CacheStore and InMemoryStore to return similarity scoresFile tree
3 files changed
+37
-11
lines changed- src/store
- src
- Bridge/Local
- Document
- tests/Bridge/Local
3 files changed
+37
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
29 | 42 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
| |||
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
| |||
201 | 208 | | |
202 | 209 | | |
203 | 210 | | |
204 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
205 | 214 | | |
206 | 215 | | |
207 | 216 | | |
| |||
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
225 | | - | |
226 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
227 | 238 | | |
228 | 239 | | |
229 | 240 | | |
| |||
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
243 | | - | |
| 254 | + | |
| 255 | + | |
244 | 256 | | |
245 | 257 | | |
246 | 258 | | |
| |||
271 | 283 | | |
272 | 284 | | |
273 | 285 | | |
274 | | - | |
| 286 | + | |
| 287 | + | |
275 | 288 | | |
276 | 289 | | |
277 | 290 | | |
| |||
0 commit comments