Tuesday, January 11, 2011

XPages: Three ways to build a search interface revisited

I decided to update the search interface demo a little bit.

Changes:
* Cleaned up/improved some of the code
* Made the ViewEntry search sortable in both directions
* Improved the ViewEntry search code, so that it should be a little quicker
* Added a load time indicator (measures the time it takes to search/sort)
* When you click to sort a column, the pager automatically goes to the first page
* Changed resorting to execute partially (partial refresh)
* Added error handling (shows up as a "validation error" box)

The app has >40k documents, so you should be able to get an impression of the performance on bigger datasets. Remember to create FT Index in the app, or it won't work. It might take some time due to the number of documents.

>> Download demoapp

4 comments:

Pablo said...

Thanks Tommy,

I'm using your approach with one of my apps. What about Db.Search instead FTSearch?

Users will have the limitation to see only docs already indexed.

What I did to allow users to open documents from Data Table was to add a field definition with the UniversalID

fieldName: 'caseid',
formula: @Text(@DocumentUniqueID)',
dataType: 'string'

Then I create a link to open a Page with caseid as DocumentID parameter.

Regards,

Pablo

Tommy Valand said...

If you want, I can implement automatic updating of FT-index on search..? That's what I do in my production apps. Works beautifully.

db.search is a little bit slower, so I mostly use FTSearch.

For the templated search demo, I believe that I added unid and noteId as default fields regardless of fieldDefinitions in the latest version. The reason is that it's always handy to have them around when you want to do more with the view than show values. E.g. creating links, as you mention.

Pablo said...

Thanks Tommy,

Automatic updating of FT-index will be handy because I just got my first complains in Production. Some users created some docs and then tried to find docs and they were not indexed yet.

Are you referring to db.UpdateFTIndex(False)? If so, I think Full Text will be executed on Server but it will take some seconds or minutes to be updated...

Pablo

Tommy Valand said...

I've updated the demoapp, so that it updates the FTIndex if needed when the user executes a query.