Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-425

Use Hibernate Search with Apache Lucene for Patient Searches



    • Medium
    • 2016-11-29 Platform 2.1.0



      Currently, OpenMRS searches for patients by running some complex hibernate queries against our relational data model. We can get better performance (e.g. like mentioned here) and better functionality (such as searching by more fields) by changing our implementation to be based on hibernate-search.

      As part of TRUNK-2999 we integrated hibernate-search into the platform, and started using it for concept searches. The purpose of this ticket is to do similar work, and start using hibernate-search in our patient and person searches.

      Tech Notes

      Make sure you review the changes that were made as part of TRUNK-2999. The changes in this ticket will be similar.

      Acceptance Criteria

      1. Existing behaviors for searching for a patient are preserved
        1. Searching by exact patient identifier finds the patient (and no others)
        2. Searching by a single name component finds patients, sorted in an intelligent order
        3. Searching by multiple name component finds patients, sorted in an intelligent order
        4. (To Do: are there more?)
      2. Typing the value of a person attribute whose type is searchable (see docs) finds the patient.
      3. Searching by a name fragment and a searchable person attribute returns patients who match both criteria
      4. Searching for a patient by String uses hibernate-search, instead of plain hibernate queries
      5. Searching for a person by String uses hibernate-search, instead of plain hibernate queries
      6. The PatientSearchCriteria class is deprecated
      7. Searching against a demo database with 100000 patients is measurably faster


      This ticket is about making backwards-compatible changes to openmrs-core's patient/person search APIs. We should make sure that any downstream changes have tickets created for them, but they are out of scope for this ticket.

      For example:

      • the registrationcore module can have improved similar patient matching algorithms after this ticket is done
      • the namephonetics module may need to be refactored after this ticket is done
      • HibernatePersonDAO.getSimilarPeople() should be refactored after this ticket is done
      • TODO: more

      Gliffy Diagrams


          1. 2274.patch
            61 kB
          2. lib.tar.2.gz
            6.34 MB
          3. lib.tar.gz
            8.59 MB
          4. openmrs-2274.patch
            5 kB

          Issue Links



                raff Rafal Korytkowski
                aravindm Aravind Madishetty [X] (Inactive)
                0 Vote for this issue
                10 Start watching this issue



                  Time Tracking

                    Original Estimate - Not Specified
                    Not Specified
                    Remaining Estimate - 0 minutes
                    Time Spent - 1 week, 1 day
                    1w 1d