Skip to content
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

Trunk-5680 - For Debug reasons - Refactor getSimilarPeople to use Lucene #3116

Closed
wants to merge 3 commits into from

Conversation

fruether
Copy link
Contributor

@fruether fruether commented Jan 13, 2020

Description of what I changed

This PR is mainly to discuss the subject in the following thread: https://talk.openmrs.org/t/soundex-search-in-lucenequeries/26068/10

So please stop focusing on beautification/formal issues of this PR: It is not intended to be merged into the code base. Focus right now is to make the code work. After!!!!!!!!!, it is working I will of cause re-work on the code and make it match the formal and quality criteria. So please focus your review effort on making it work or spend the time on another PR. Thank you!

Issue I worked on

see https://issues.openmrs.org/browse/Trunk-5680

Checklist: I completed these to help reviewers :)

  • My pull request only contains ONE single commit
    (the number above, next to the 'Commits' tab is 1).

    No? -> read here on how to squash multiple commits into one

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@fruether fruether force-pushed the TRUNK-5680 branch 9 times, most recently from 6759c09 to b90e31d Compare January 13, 2020 20:23
@HerbertYiga
Copy link
Contributor

you can get the commits squashed here!!

int maxResults = HibernatePersonDAO.getMaximumSearchResults();

LuceneQuery<PersonName> luceneQuery = personLuceneQuery.getSoundexPersonNameQuery(query, 0, true, "M");;
//getSoundexPersonNameQuery(query,birthyear, false, gender);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code

temp_OutSource_Operation(name);
//q.append("(").append(" soundex(pname.givenName) = soundex(:n1)").append(
// " or soundex(pname.middleName) = soundex(:n1)").append(" or soundex(pname.familyName) = soundex(:n1) ")
// .append(" or soundex(pname.familyName2) = soundex(:n1) ").append(")");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code

Comment on lines 77 to 78
//(year(p.birthdate) between " + (birthyear - 1) + " and " + (birthyear + 1)
// + " or p.birthdate is null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code

Comment on lines 87 to 88
// luceneQuery.include("voided", false);
// luceneQuery.include("person.voided", false);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if block is empty. You can remove it


if(gender != null) {
String[] searchedGenders = new String[] {gender, ""};
//luceneQuery.include("person.gender", searchedGenders);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove commented code

@fruether
Copy link
Contributor Author

fruether commented Jan 15, 2020 via email

@rkorytkowski
Copy link
Member

@fruether, I don't see anything obvious. I'll run your code once I have some spare cycles. Probably next week.

@saadkhaleeq610
Copy link

Nice :) You can remove the comments.

@jwnasambu
Copy link
Contributor

jwnasambu commented Jan 20, 2020

@saadkhaleeq610 why should the comment be removed? Comments are added with the purpose of making the source code easier for human to understand, and are generally ignored by compilers and interpreters. I anticipated you to talk about about the Travis CI failure in this case.

@fruether
Copy link
Contributor Author

@jwnasambu this PR does not have the intend to be merged into the code base. It only has the reason to help the discussion in talk. That is why the "comments" can be ignored for now. They will be fixed once the code is working. Then I will do the beautification regarding adding source code comments, variable names, code squashing and so on.

Once I figured with the help of @rkorytkowski out what is missing, I will recreate the PR with . the previous comments taken into account :)

@@ -84,6 +98,7 @@ public void setSessionFactory(SessionFactory sessionFactory) {
if (birthyear == null) {
birthyear = 0;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary line here


//

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is empty, please remove it :)

.param("encoder", "Soundex")
.param("inject", "true");


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary blank line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sumangala028 thanks for your review. But as I pointed out above: The code of this PR does not work. So we should focus on making the code work and then after that is established we can focus on more formal and beautification issues.

if you want to participate helping to make this code work: https://talk.openmrs.org/t/soundex-search-in-lucenequeries/26068/13

Otherwise I think the energy could be rather used on different reviews.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... thanks for pointing me to the discussion of this issue. Yes, the beautification issues can be pushed back till the code is fixed.

@fruether fruether changed the title Trunk-5680 - Refactor getSimilarPeople to use Lucene Trunk-5680 - For Debug reasons - Refactor getSimilarPeople to use Lucene Feb 2, 2020
@fruether
Copy link
Contributor Author

fruether commented Feb 2, 2020

@fruether, I don't see anything obvious. I'll run your code once I have some spare cycles. Probably next week.

@rkorytkowski Is there a time slot during Februrary where you may have some spare time to run the code? Any hint what I can do/try out while waiting for feedback?

@brandones
Copy link
Contributor

Hi @fruether , nice work on this. My recommendation would be to write some tests (parallel to the patient search test I wrote, which checks whether accent flattening works). I think that will help clarify the problem, and also provide a nice entry point for debugging.

@fruether fruether force-pushed the TRUNK-5680 branch 2 times, most recently from 051ec5c to d1ba85e Compare March 18, 2020 22:12
@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 60.28% when pulling 5e078fd on fruether:TRUNK-5680 into 9345129 on openmrs:master.

@fruether fruether closed this Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants