Blog do projektu Open Source JavaHotel

niedziela, 1 kwietnia 2012

Search and filter enhancement

General

I added simple enhancement to search and filter interface.
It is not easy to design a good search and filter mechanism. On one hand it should be powerful enough to allow the user to find what he/she needs, on the other it cannot be complicated because it would be rejected. So how to combine together effectiveness and usability. I don't mean that I'm in a possession of the magic formula but to my thinking the most convenient way is the "from - to" or "equal to" paradigm. Something like: "find all persons of age from 20 to 30" or "find all persons living in .. eg. find all persons whose place of residence is equal to ..".
Another approach to make the filter/searching mechanism as simple as possible is avoiding any additional improvement or modifiers (check or radio boxes) something like "in case of something cannot be found try something else" because it makes all stuff very complicated and finally it is not obvious what is looked for and what is found.
So I ended up with simple "from value" - "to value" schema without any buetyfiers.




















The formula is a simple as follows:
  • If neither "from" nor "to" value is entered then this field (attribute) is ignored during searching.
  • If only "from" value is enter ("to" remains empty) then mechanism picks up rows equal to the "to" value.
  • If both "from" and "to" values are entered then all rows between (inclusive) them are selected.
  • If only "to" value is entered ("from" remains empty) then all rows less or equal to the "to" value are selected.
  • All "from" - "to"  lines are participating in the query in "and" manner. For instance: if filter for "Symbol" attribute is used (meaning that either "from" or "to" value is not empty) and the same for "Nazwa" attribute then all rows passing both tests are selected.

To my experience that simple and intuitive mechanism is well appreciated by most users and enough in  most cases. Of course it is possible to enrich this schema by adding a lot of checboxes like ("and", "or", "equal", "less then") but it makes all stuff more complicated and does not bring many more value.

But, unfortunately, I was unable to keep to it any longer. Very often user needs to find something like "find all rows equal or greater than value" and this mechanism does not allow it. It is possible to put into "to" field very big value but it is artificial.
So I ended up with adding additional check box(GUI layout needs some improvements) :


The meaning of this additional check box is as follows.
If "from" value is entered and "to" value is empty then
  • If checkbox is checked then select all rows equal to the "from" value (default).
  • If check box is unchecked than find all rows equal or greater then "from" value.
 I'm not very happy with that because I had to break a rule (no single checkbox at all) but I was unable to find any other solution.

Demo version
Demo version is available here. The source code is available here. The data is persisted by means of Google App Engine for Java (JPA). The code for persistence layer and entity bean is also available.

Brak komentarzy:

Prześlij komentarz