chore: Index multi-properties by default - #951
Conversation
|
I think this needs to be blocked by #937. Also, it's not clear which kind of index should be created. We should discuss how this interacts with these issues, too: |
This comment was marked as outdated.
This comment was marked as outdated.
|
lets add an option to the macro to set the index type. (PropertyIndexType::FullIndex); |
This comment was marked as outdated.
This comment was marked as outdated.
RobertJacobsonCDC
left a comment
There was a problem hiding this comment.
PR #937 removed sharing indexes between properties. This PR appears to reintroduce shared properties. I don't think we want to do this. Instead, let's retain the warning and error behavior explicitly introduced in #937. I think this will simplify this PR quite a bit.
There's also the philosophical question of whether we want to expose Property::default_index_type as public API. So for example, we could add a parameter to define_*_property! / impl_*_property that lets client code set the return value of Property::default_index_type. But let's defer that question to another issue / PR. (I don't think we have a use case for it, so let's not pay the cost of added code complexity.)
|
Fixed. Equivalent multi-properties now use distinct storage; only the registered representative receives the default index. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
This PR is a lot more invasive than I expected, and I can't tell if it is because I don't fully understand some edge cases or if the complexity is genuinely unnecessary. The PR adds:
The What I expected is that the function stored in Am I missing something? |
Construct each property value store and its optional new-entity index dispatcher as one matched value. Preserve configurable multi-property defaults while ensuring indexes remain independent between contexts. Add regression coverage for context isolation and indexing future entities after an explicit upgrade.
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
Not Compared (no baseline yet)
|
Thanks—there is one constraint here that was not obvious from the previous I agree that default-index construction belongs with property-value-store
The reason
impl<E: Entity, P: Property<E>> PropertyValueStoreCore<E, P> {
fn new_boxed() -> Box<dyn PropertyValueStore<E>> {
// ...
}
}However, constructing either index requires: P: IndexableProperty<E> // Property<E> + Eq + HashThat requirement is visible in Rust cannot acquire the
The two registration entry points are the narrow compile-time bridge between
The relevant The dispatcher is required because constructing an empty index is not There is regression coverage showing that:
So your expectation is correct in principle: the registered constructor should |
Summary
define_multi_property!create aFullIndexby default viaProperty::default_index_type.ValueCountIndexor opt outwith
PropertyIndexType::Unindexed.Property: Eq + Hashconstraint withIndexableProperty#937’s no-shared-storage design: equivalent multi-properties remaindistinct, while the first registered representative handles query routing and
is the only one eligible for a default index.
Context::index_propertycalls compatible with populatedmulti-properties, including default-indexed and unindexed definitions.
equivalent property ordering, and explicit indexing.