-
Notifications
You must be signed in to change notification settings - Fork 6
[NAE-2267] For some mongo collections there are no indexes #386
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
base: release/7.0.0-rev9
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.netgrif.application.engine.objects.annotations; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE}) | ||
| public @interface Indexable { | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package com.netgrif.application.engine.objects.petrinet.domain; | ||
|
|
||
| import com.netgrif.application.engine.objects.annotations.Indexable; | ||
| import com.netgrif.application.engine.objects.annotations.Indexed; | ||
| import com.netgrif.application.engine.objects.auth.domain.ActorRef; | ||
| import com.netgrif.application.engine.objects.petrinet.domain.arcs.Arc; | ||
| import com.netgrif.application.engine.objects.petrinet.domain.arcs.reference.Referencable; | ||
|
|
@@ -24,6 +26,7 @@ | |
| import java.util.*; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| @Indexable | ||
| @QueryEntity | ||
| public abstract class PetriNet extends PetriNetObject { | ||
|
|
||
|
|
@@ -57,6 +60,7 @@ public abstract class PetriNet extends PetriNetObject { | |
|
|
||
| @Getter | ||
| @Setter | ||
| @Indexed | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that The Run the following script to analyze query patterns for both 🏁 Script executed: #!/bin/bash
# Description: Search for query patterns using initials and identifier fields to determine indexing priorities
echo "=== Searching for queries using 'initials' field ==="
rg -n --type=java -C3 'findBy.*Initials|initials.*equals|criteria.*initials|query.*initials' -i
echo -e "\n=== Searching for queries using 'identifier' field ==="
rg -n --type=java -C3 'findBy.*Identifier|identifier.*equals|criteria.*identifier|query.*identifier' -i
echo -e "\n=== Checking PetriNet repository/query usage ==="
ast-grep --pattern 'class $_ implements $$$Repository<PetriNet$$$> {
$$$
}'Length of output: 38196 Now I need to inspect the PetriNet.java file to see the actual index definitions and the comment mentioned in the review:<!-- [scratchpad_continue]
[critical_missing_info]
[next_action]
Now let me inspect the PetriNet.java file to see the current index definitions: [/run_scripts] Based on the query pattern analysis from the script output, here are my findings: Query patterns for
Query patterns for
The evidence shows:
Verify that The Consider adding a compound index on 🏁 Script executed: #!/bin/bash
# Extract the PetriNet class definition with focus on indexes and line 36
cat nae-object-library/src/main/java/com/netgrif/application/engine/objects/petrinet/domain/PetriNet.java | head -100Length of output: 2927 Add compound index on The PR adds The current implementation indexes only
Add the missing compound index definition to the class level (using Spring Data's 🤖 Prompt for AI Agents |
||
| private String initials; | ||
|
|
||
| @Getter | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider making
@Indexable@Inheritedto support entity hierarchiesRight now
@Indexableis not@Inherited, so subclasses won’t be treated as indexable unless they also declare the annotation. If your Mongo root entities are often concrete subclasses of abstract bases likeCase,Task, orPetriNet, adding@Inheritedwould reduce the risk of missing indexes when new subclasses are introduced.Example:
If you intentionally want only explicitly annotated concrete types to be indexable, the current setup is fine.
🤖 Prompt for AI Agents