# Patient Search Functionality - Bug?

**URL:** <https://talk.openmrs.org/t/patient-search-functionality-bug/13252>\
**Category:** Bahmni\
**Created:** [September 9, 2017, 5:02pm UTC](https://talk.openmrs.org/t/patient-search-functionality-bug/13252 "2017-09-09T17:02:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nawazshaikh](https://talk.openmrs.org/letter_avatar/nawazshaikh/32/6_22734026db12803ebb3e059622ac3534.png) [@nawazshaikh](https://talk.openmrs.org/u/nawazshaikh)\
**Post date:** [September 9, 2017, 5:02pm UTC](https://talk.openmrs.org/t/patient-search-functionality-bug/13252/1 "2017-09-09T17:02:54Z")

</div>

I have a field named “Referred By” on the patient registration page. The search includes this field and mobile number as follows: “patientSearch”: { “address”: { “label”: “Locality”, “placeholder”: “Enter Locality”, “field”: “address2” }, “customAttributes”: { “label”: “Referred By/Mobile No”, “placeholder”: “Enter Details”, “fields”: [“mobileNo”, “referredBy”] } } Now when searched for “AK Sharma” in “Referred By” why should the third record appear?

 ![](https://talk.openmrs.org/uploads/default/original/2X/e/eb37995f886ed6d723a31884f4f6607c833e9fc3.png)Trying to go through the code.

---

<div class="post-metadata">

**Author:** ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)\
**Post date:** [September 10, 2017, 8:00am UTC](https://talk.openmrs.org/t/patient-search-functionality-bug/13252/2 "2017-09-10T08:00:22Z")

</div>

Hi @nawazshaikh,

Those custom attributes are passed to the underlying SQL query [here](https://github.com/Bahmni/bahmni-core/blob/6105f028bfce34529e06e166adc5d1e05101dcbe/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/PatientDaoImpl.java#L66) in Bahmni Core.

The best way to ascertain a bug would be to provoke it through a new test case reproducing your scenario in `BahmniPatientDaoImplIT`. Something like [this](https://github.com/Bahmni/bahmni-core/blob/6105f028bfce34529e06e166adc5d1e05101dcbe/bahmnicore-api/src/test/java/org/bahmni/module/bahmnicore/dao/impl/BahmniPatientDaoImplIT.java#L166-L173) one for example.

The above is assuming that the issue lies in Bahmni Core of course.
