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
FINERACT-1754: Fix Search API #3311
FINERACT-1754: Fix Search API #3311
Conversation
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Show resolved
Hide resolved
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/fineract/portfolio/search/service/SearchReadPlatformServiceImpl.java
Outdated
Show resolved
Hide resolved
@@ -90,7 +90,7 @@ public String searchSchema(final SearchConditions searchConditions) { | |||
+ " order by l.id desc"; | |||
|
|||
final String savingMatchSql = " (select 'SAVING' as entityType, s.id as entityId, sp.name as entityName, s.external_id as entityExternalId, s.account_no as entityAccountNo " | |||
+ " , coalesce(c.id,g.id) as parentId, coalesce(c.display_name,g.display_name) as parentName, null as entityMobileNo, s.status_enum as entityStatusEnum, s.deposit_type_enum as subEntityType, CASE WHEN g.id is null THEN 'client' ELSE 'group' END as parentType " | |||
+ " , coalesce(c.id,g.id) as parentId, coalesce(c.display_name, g.display_name) as parentName, null as entityMobileNo, s.status_enum as entityStatusEnum, concat(s.deposit_type_enum, '') as subEntityType, CASE WHEN g.id is null THEN 'client' ELSE 'group' END as parentType " |
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.
Every other places the subEntityType
is null, i dont think thats the place to fix this. Please rather have a condition in the mapper if you dont wanna see DepositType.INVALID
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.
The reason to have this is because the RDBMS can not have in the same column strings (due the nulls) and integer for the Savings for the column deposit types
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.
Nothing changed...
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.
If we leave the original SQL we get an error when we use more than one resource why? because the column subEntityType (as you have viewed) in almost all the SQL uses null (the null is considered as string type by the RDBMS) and in the Savings SQL filter It has a value for the Savings attribute deposit_type_enum (int type) and that difference to the RDBMS generates tan error, so It is not possible to manage after run the SQL in the mapper
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.
how does solve this problem by changing this to not be null only one place? what happens if you search in SAVINGS accounts and LOAN accounts?
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.
There will be not a problem, because in the SQL both values are now Strings values in the Loan will be null and in the Savings will be the Deposit Type (if exists) as String
too. We get this because we are using the concat
function. Even in the POJO SearchData
this attribute is String
type
private final String subEntityType;
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.
Please kindly see my comments!
c473504
to
832494d
Compare
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.
Kindly asking you to reply on my questions before marking them as resolved!
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.
LGTM
Description
Fix the Internal Server Error in the Search by Resource API when we use more than one
resource
It includes the Integration Tests for the Search API too
Ignore if these details are present on the associated Apache Fineract JIRA ticket.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Write the commit message as per https://github.com/apache/fineract/#pull-requests
Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
Create/update unit or integration tests for verifying the changes made.
Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.