Search code examples
javascriptsearchxpageslotus-domino

XPages Domino search producing incorrect results for one particular search term


I have a large domino database that I am searching with some very basic syntax: [LastName] CONTAINS "Name or first letter or letters of name to search for"*

Specific example: [LastName] CONTAINS R* This returns all lastnames that start with "R".

This works very well on any letter except for "S". If you just search for all lastnames beginning with "S", you will only get a very small result which is wrong. If the query is further qualified by a location it will return 0 results. [LastName] CONTAINS S* AND [Campus] CONTAINS 101 Returns 0 results which I know is not true.

However, [LastName] CONTAINS Se* AND [Campus] CONTAINS 101 will return all the lastnames at Campus 101 that begin with Se. [LastName] CONTAINS Se* will return the correct results.

This happens with both the FirstName and the LastName fields. Other fields do not display this anomaly. Could there be a corrupt record? If so, is it possible to isolate it?

Thanks, ---Lisa&


Solution

  • Full text search in Domino doesn't work reliable for one letter.

    Use search() instead with a formula like:

    @Begins(LastName; "R") & @Contains(Campus; "101")
    

    SSJS search() would be:

    var searchFormula = 'Begins(LastName; "R") & @Contains(Campus; "101")';
    var dc:NotesDocumentCollection = database.search(searchFormula);
    

    Use NotesDocumentCollection to show relevant fields (including links to documents) in a repeat control.