XPages typeahead takes too long

Cumhur Ata

When we try typeahead with ftSearch , it takes too long to complete (to be shown on the screen). ftsearch finishes at the same time

[0D88:000B-0B44] 30.12.2015 10:03:06   HTTP JVM: Start= 30.12.2015 10:03
[0D88:000B-0B44] 30.12.2015 10:03:06   HTTP JVM: Finish= 30.12.2015 10:03

But in the inputbox which has typeahead properties results return more then 5 seconds. I mean It takes too long.

is there any suggestion how to decrease the time

'fldDefName = inthe inputbox there is a option for ftSearch named "Var" colNumber = Column Number for results. I generally user [0]
 function getTypeAheadList(vName,frmName,fldName,fldDefName,colNumber) 
{
 var searchView:NotesView = database.getView(vName);'
    var query = "(FIELD Form CONTAINS "+ frmName + " AND FIELD " + fldName + " CONTAINS *" + fldDefName +"*)";
    print("Query= "+query);
    var searchOutput:Array = ["å","åå"];
    var hits = searchView.FTSearch(query);
    var entries = searchView.getAllEntries();
    var entry = entries.getFirstEntry();

    for (i=0; i<hits; i++) 
    {
        searchOutput.push(entry.getColumnValues()[colNumber]);
        entry = entries.getNextEntry();
    }
    searchOutput.sort();

    var result ="<ul><li><span class='informal'></span></li>";
    var limit = Math.min(hits,50);

    for (j=0; j<limit; j++) 
    {
        var name = searchOutput[j].toString();
        var start = name.indexOfIgnoreCase(lupkey)
        var stop = start + lupkey.length;

        name = name.insert("</b>",stop).insert("<b>",start);
        result += "<li>" + name + "</li>"; 
    }

    result += "</ul>";
    return result;
Knut Herrmann

Reduce the number of docs that will be returned by FTSearch to 50 with

var hits = searchView.FTSearch(query, 50);

Right now the search result might contain e.g. 5000 docs and it takes time to push them into searchOutput and to sort. You reduce the hints afterwards to 50 anyway...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related