Commit 291036a
committed
feat(#677): generate indexed subfields for @reference fields
When a document has a @reference @indexed field pointing to another entity,
the metamodel now generates field accessors for the referenced entity's
indexed/searchable fields, enabling queries like:
entityStream.of(RefVehicle.class)
.filter(RefVehicle$.OWNER_NAME.eq("John"))
.collect(...)
Changes:
- MetamodelGenerator: Add processReferencedEntityIndexableFields() to generate
metamodel fields for all indexed annotations (@indexed, @searchable,
@TagIndexed, @TextIndexed, @NumericIndexed, @GeoIndexed, @VectorIndexed)
- RediSearchIndexer: Add createIndexedFieldsForReferencedEntity() to create
index fields with full attribute support (sortable, noindex, indexMissing,
indexEmpty, phonetic, weight, nostem, separator)
- Support for VectorIndexed fields with FLAT/HNSW algorithms
- Support for Date/time types (LocalDateTime, LocalDate, Date, Instant,
OffsetDateTime) as numeric fields
- Support for UUID and Ulid types as tag fields
Note: @reference fields store only the entity ID, not the full object.
Searching by referenced entity properties requires denormalized data.
The metamodel fields are generated for API consistency.1 parent 548b1aa commit 291036a
File tree
4 files changed
+136
-4
lines changed- redis-om-spring/src/main/java/com/redis/om/spring
- indexing
- metamodel
- tests/src/test/java/com/redis/om/spring
- annotations/document
- fixtures/document/model
4 files changed
+136
-4
lines changedLines changed: 49 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1320 | 1320 | | |
1321 | 1321 | | |
1322 | 1322 | | |
| 1323 | + | |
| 1324 | + | |
1323 | 1325 | | |
1324 | 1326 | | |
1325 | 1327 | | |
| |||
1415 | 1417 | | |
1416 | 1418 | | |
1417 | 1419 | | |
1418 | | - | |
1419 | | - | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1420 | 1423 | | |
1421 | 1424 | | |
1422 | 1425 | | |
| |||
1436 | 1439 | | |
1437 | 1440 | | |
1438 | 1441 | | |
1439 | | - | |
| 1442 | + | |
| 1443 | + | |
1440 | 1444 | | |
1441 | 1445 | | |
1442 | 1446 | | |
| |||
1483 | 1487 | | |
1484 | 1488 | | |
1485 | 1489 | | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
1486 | 1532 | | |
1487 | 1533 | | |
1488 | 1534 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
856 | | - | |
| 856 | + | |
857 | 857 | | |
858 | 858 | | |
859 | 859 | | |
| |||
Lines changed: 71 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
247 | 318 | | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
50 | 65 | | |
0 commit comments