# PersonAttribute - keyword search - different behavior on different machines

**URL:** <https://talk.openmrs.org/t/personattribute-keyword-search-different-behavior-on-different-machines/13857>\
**Category:** Bahmni\
**Created:** [October 24, 2017, 5:44pm UTC](https://talk.openmrs.org/t/personattribute-keyword-search-different-behavior-on-different-machines/13857 "2017-10-24T17:44:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nawazshaikh](https://talk.openmrs.org/letter_avatar/nawazshaikh/32/5_5575768a8748004e209b776fc1b2916d.png) [@nawazshaikh](https://talk.openmrs.org/u/nawazshaikh)\
**Post date:** [October 24, 2017, 5:44pm UTC](https://talk.openmrs.org/t/personattribute-keyword-search-different-behavior-on-different-machines/13857/1 "2017-10-24T17:44:24Z")

</div>

Development Environment - Person Attribute search works like key word search (This is what we want)

 ![image](https://talk.openmrs.org/uploads/default/original/2X/b/baba12614b10f1ca735253b7fe26456fbb6eb733.jpg)

Production Environment - Person Attribute search works on matching start of string ![image](https://talk.openmrs.org/uploads/default/original/2X/1/1572fbe1d0a39fc948d6209991862e24d3cb2eda.png)

On typing "Dus’ doesn’t get the data like development environment gets data for “sha” shown above. ![image](https://talk.openmrs.org/uploads/default/original/2X/4/4735bfc47b8e4b25ad71e47dc5afa54fe6f69207.png)

---

<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:** [October 24, 2017, 6:41pm UTC](https://talk.openmrs.org/t/personattribute-keyword-search-different-behavior-on-different-machines/13857/2 "2017-10-24T18:41:55Z")

</div>

I think this happens [here](https://github.com/Bahmni/bahmni-core/blob/35239a2bedb58dbb2789772ef848c13f1577f569/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/PersonAttributeDaoImpl.java#L25) for person attribute searches:

```java
sqlQuery.setParameter("value", query.toLowerCase() + "%");

```

Which seems to match the behaviour that you observe in your production environment.  
The query is slightly different for person name searches [here](https://github.com/Bahmni/bahmni-core/blob/35239a2bedb58dbb2789772ef848c13f1577f569/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/PersonNameDaoImpl.java#L23):

```java
criteria.add(Restrictions.ilike(key, query + "%"));

```

In both case the syntax is consistent with a ‘start with’ logic.

The good news is that you observe the unexpected behaviour in your dev. environment, which will let you dig further and see why/how what you observe does happen. Is that something you could do?

---

<div class="post-metadata">

**Author:** ![nawazshaikh](https://talk.openmrs.org/letter_avatar/nawazshaikh/32/5_5575768a8748004e209b776fc1b2916d.png) [@nawazshaikh](https://talk.openmrs.org/u/nawazshaikh)\
**Post date:** [October 24, 2017, 6:54pm UTC](https://talk.openmrs.org/t/personattribute-keyword-search-different-behavior-on-different-machines/13857/3 "2017-10-24T18:54:18Z")

</div>

> [@mksd](#):
>
> The good news is that you observe the unexpected behaviour in your dev. environment, which will let you dig further and see why/how what you observe does happen. Is that something you could do?

Yes, I also observed that and only to compare how patient search works, I noticed that the SQL Query has (family\_name)) like %value%. So I will dig it further in development environment for personattribute and keep you posted.
