Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1031: partially revert change #1005, making default Projection go back to "include all" #1033

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,21 @@ private DocumentProjector(
}

public static DocumentProjector defaultProjector() {
return DefaultProjectorWrapper.defaultProjector();
/* 16-Apr-2024, tatu: For v1.0.6 need to revert to default being
"include all", and then go back to "exclude $vector/$vectorize"
for v1.0.7 or later.
*/
// return DefaultProjectorWrapper.defaultProjector();
return INCLUDE_ALL_PROJECTOR;
}

public static DocumentProjector defaultProjectorWithSimilarity() {
/* 16-Apr-2024, tatu: For v1.0.6 need to revert to default being
"include all", and then go back to "exclude $vector/$vectorize"
for v1.0.7 or later.
*/
// return DefaultProjectorWrapper.defaultProjectorWithSimilarity();
return INCLUDE_ALL_PROJECTOR_WITH_SIMILARITY;
}

public static DocumentProjector includeAllProjector() {
Expand All @@ -75,9 +89,9 @@ public static DocumentProjector createFromDefinition(
// First special case: "simple" default projection
if (projectionDefinition == null || projectionDefinition.isEmpty()) {
if (includeSimilarity) {
return DefaultProjectorWrapper.defaultProjectorWithSimilarity();
return defaultProjectorWithSimilarity();
}
return DefaultProjectorWrapper.defaultProjector();
return defaultProjector();
}
if (!projectionDefinition.isObject()) {
throw new JsonApiException(
Expand Down Expand Up @@ -169,7 +183,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return rootLayer.hashCode();
return (rootLayer == null) ? -1 : rootLayer.hashCode();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public void byIdAfterUpdate() {
"name": "Joe",
"age": 42,
"enabled": true,
"$vector" : [ 0.5, -0.25 ],
"value": -1
}
"""))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ public void defaultProjectionMixAll() throws Exception {
{
"_id" : 1,
"value1": 42,
"$vectorize": "Quick brown fox",
"$vector": [0.0, 1.0],
"value2": -3
}
"""));
Expand Down
Loading