Skip to content

Commit

Permalink
CIV-11414 - Updated trial ready WA search services (#3528)
Browse files Browse the repository at this point in the history
* CIV-11414 - Updated trial ready WA search services

* CIV-11414 - updated tests

---------

Co-authored-by: vasudevganesanhmcts <[email protected]>
  • Loading branch information
m-meulendijks-v1 and vasudevganesanhmcts authored Nov 7, 2023
1 parent 29cd440 commit 3e31b49
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
import static org.elasticsearch.index.query.QueryBuilders.rangeQuery;
import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS;
import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING;

@Service
Expand All @@ -30,7 +31,10 @@ public Query query(int startIndex) {
.must(rangeQuery("data.hearingDate").lt(LocalDate.now()
.atTime(LocalTime.MIN).plusWeeks(3)
.toString()))
.must(beState(PREPARE_FOR_HEARING_CONDUCT_HEARING))
.must(boolQuery()
.minimumShouldMatch(1)
.should(beState(PREPARE_FOR_HEARING_CONDUCT_HEARING))
.should(beState(HEARING_READINESS)))
.mustNot(matchQuery("data.allocatedTrack", "SMALL_CLAIM"))
.mustNot(matchQuery("data.trialReadyChecked", "Yes"))),
List.of("reference"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
import static org.elasticsearch.index.query.QueryBuilders.rangeQuery;
import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS;
import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING;

@Service
Expand All @@ -32,10 +33,13 @@ public Query query(int startIndex) {
.must(rangeQuery("data.hearingDate").lt(LocalDate.now()
.atTime(LocalTime.MIN)
.plusWeeks(6).toString()))
.must(beState(PREPARE_FOR_HEARING_CONDUCT_HEARING)))
.must(boolQuery()
.minimumShouldMatch(1)
.should(beState(PREPARE_FOR_HEARING_CONDUCT_HEARING))
.should(beState(HEARING_READINESS)))
.mustNot(matchQuery("data.allocatedTrack", "SMALL_CLAIM"))
.mustNot(matchQuery("data.listingOrRelisting", ListingOrRelisting.RELISTING))
.mustNot(matchQuery("data.trialReadyNotified", YesOrNo.YES)),
.mustNot(matchQuery("data.trialReadyNotified", YesOrNo.YES))),
List.of("reference"),
startIndex
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ protected Query buildQuery(int fromValue) {
.should(boolQuery()
.must(rangeQuery("data.hearingDate").lt(LocalDate.now().atTime(LocalTime.MIN).plusWeeks(3)
.toString()))
.must(boolQuery().must(matchQuery("state", "PREPARE_FOR_HEARING_CONDUCT_HEARING")))
.must(boolQuery()
.minimumShouldMatch(1)
.should(boolQuery().must(matchQuery("state", "PREPARE_FOR_HEARING_CONDUCT_HEARING")))
.should(boolQuery().must(matchQuery("state", "HEARING_READINESS"))))
.mustNot(matchQuery("data.allocatedTrack", "SMALL_CLAIM"))
.mustNot(matchQuery("data.trialReadyChecked", "Yes")));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ protected Query buildQuery(int fromValue) {
.should(boolQuery()
.must(rangeQuery("data.hearingDate").lt(LocalDate.now().atTime(LocalTime.MIN).plusWeeks(6)
.toString()))
.must(boolQuery().must(matchQuery("state", "PREPARE_FOR_HEARING_CONDUCT_HEARING"))))
.must(boolQuery()
.minimumShouldMatch(1)
.should(boolQuery().must(matchQuery("state", "PREPARE_FOR_HEARING_CONDUCT_HEARING")))
.should(boolQuery().must(matchQuery("state", "HEARING_READINESS"))))
.mustNot(matchQuery("data.allocatedTrack", "SMALL_CLAIM"))
.mustNot(matchQuery("data.listingOrRelisting", ListingOrRelisting.RELISTING))
.mustNot(matchQuery("data.trialReadyNotified", YesOrNo.YES));
.mustNot(matchQuery("data.trialReadyNotified", YesOrNo.YES)));

return new Query(query, List.of("reference"), fromValue);
}
Expand Down

0 comments on commit 3e31b49

Please sign in to comment.