Skip to content

Commit

Permalink
small code refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Jun 11, 2024
1 parent 854d5e2 commit 7f14ba5
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 245 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test_analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build, run tests and analyse
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -Dsonar.projectKey=europeana_annotation
run: mvn -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -Dsonar.projectKey=europeana_annotation
env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,17 @@ private SolrQuery solrUniquenessQueryDebias(Annotation anno, boolean noSelfDuppl
query.setQuery(WebAnnotationModelFields.MOTIVATION + ":\"" + MotivationTypes.HIGHLIGHTING.getOaType() + "\"");

StringBuilder targetOrQuery=new StringBuilder();
targetOrQuery.append("(\"" + anno.getTarget().get(0).getSource() + "\"");
//all validated annotations have at least one target
for(Target t : anno.getTarget()) {
targetOrQuery.append(" OR \"" + t.getSource() + "\"");
if(targetOrQuery.isEmpty()) {
//for first entry append the bracket
targetOrQuery.append("(\"" + anno.getTarget().get(0).getSource() + "\"");
}else {
//for the rest of the entries append the OR operator
targetOrQuery.append(" OR \"" + t.getSource() + "\"");
}
}
//close bracket in the end
targetOrQuery.append(")");
query.addFilterQuery(SolrAnnotationConstants.TARGET_URI + ":" + targetOrQuery.toString());

Expand Down
Loading

0 comments on commit 7f14ba5

Please sign in to comment.