In Domino you have multiple options how to provide a search function for an application. I have seen many examples where a FT search query is build for a database, where the form type is defined, which fields should be used in the search etcetera. Most of them are a maintenaince nightmare, layout is little flexible and usability is lacking (e.g. perform a search towards a query which will result in zero hits).
What if you make it easier to maintain, more flexible for user specific desires and add facetted search principles? A win situation?
In the following posts I will write how to use the jQuery DataTables plugin to provide a quick search function for your Domino apps. I assume you use XPages.
Stage 1 – Getting & presenting the data
In the initial stage we just try to get and present the data we need. As example I will be using the FakeNames application. I have created a public repo which has at the moment:
- an xpage to present the data (dtPersons.xsp)
- an xpage (api.xsp) which will contain rest services
- a Java class that generates the data in JSON format
- a CSJS library to transform the HTML table on dtPersons.xsp to DataTables object
- the required resources from DataTables.net
- a Theme resource to have the resources available
- a Notes view to use as data source.
In order to create some fake documents I have set up an LS agent to do so.
If you bind this all together, you have already a search function:
Right on top you have a search field where you can query the columns in the table. The columns are sortable too. Probably it is matching most of the search functions you have seen for Domino. But wait! There is more possible…