Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Indexer
Commits
448a7cc4
Commit
448a7cc4
authored
1 year ago
by
Zhibin Mai
Browse files
Options
Downloads
Patches
Plain Diff
Refactor the codes
parent
13f6bd81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!620
Support flexible condition match in Index Augmenter
Pipeline
#214395
failed
1 year ago
Stage: review
Pipeline: Indexer
#214396
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexer-core/src/main/java/org/opengroup/osdu/indexer/model/indexproperty/RelatedCondition.java
+11
-4
11 additions, 4 deletions
...up/osdu/indexer/model/indexproperty/RelatedCondition.java
with
11 additions
and
4 deletions
indexer-core/src/main/java/org/opengroup/osdu/indexer/model/indexproperty/RelatedCondition.java
+
11
−
4
View file @
448a7cc4
...
...
@@ -49,6 +49,7 @@ public class RelatedCondition {
return
true
;
}
catch
(
PatternSyntaxException
ex
)
{
//The condition can be plain text, not non-regular expression
if
(
propertyValue
.
equals
(
condition
))
return
true
;
}
...
...
@@ -62,19 +63,24 @@ public class RelatedCondition {
relatedConditionMatches
!=
null
&&
!
relatedConditionMatches
.
isEmpty
();
}
protected
boolean
hasValidCondition
(
String
property
)
{
if
(
Strings
.
isNullOrEmpty
(
property
)
||
!
this
.
hasCondition
())
return
false
;
// If it is not nested object, it is valid in terms of syntax.
if
(!
property
.
contains
(
ARRAY_SYMBOL
)
&&
!
relatedConditionProperty
.
contains
(
ARRAY_SYMBOL
))
return
true
;
return
hasMatchNestedParts
(
property
);
}
private
boolean
hasMatchNestedParts
(
String
property
)
{
if
((
property
.
endsWith
(
ARRAY_SYMBOL
)
||
relatedConditionProperty
.
endsWith
(
ARRAY_SYMBOL
))
||
(
property
.
contains
(
ARRAY_SYMBOL
)
&&
!
relatedConditionProperty
.
contains
(
ARRAY_SYMBOL
))
||
(!
property
.
contains
(
ARRAY_SYMBOL
)
&&
relatedConditionProperty
.
contains
(
ARRAY_SYMBOL
)))
return
false
;
// If it is not nested object, it is valid in terms of syntax.
if
(!
property
.
contains
(
ARRAY_SYMBOL
)
&&
!
relatedConditionProperty
.
contains
(
ARRAY_SYMBOL
))
return
true
;
property
=
this
.
getSubstringWithLastArrayField
(
PropertyUtil
.
removeDataPrefix
(
property
));
String
conditionProperty
=
this
.
getSubstringWithLastArrayField
(
...
...
@@ -93,6 +99,7 @@ public class RelatedCondition {
return
true
;
}
private
String
getSubstringWithLastArrayField
(
String
property
)
{
return
property
.
substring
(
0
,
property
.
lastIndexOf
(
ARRAY_SYMBOL
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment