Xpages 在查看 FTSearch 后没有结果 [英] Xpages no results after FTSearch on view
问题描述
我的应用程序中有一个搜索模块,可根据用户选择过滤多个视图.
I have a search module in my application which filters multiple views, depending on the user choice.
如果搜索没有结果,我想添加一个对话框,而不是将视图显示为空.我该怎么做?
I want to add a dialog if the search has no results, instead of showing the view empty. How can I do this?
我尝试获取 rowCount() 但它似乎没有获取正确的行数,我不知道为什么.
I have tried to get rowCount() but it seems it is not getting the right number of rows, I don't know why.
SSJS 代码:
var vw=database.getView("vwCautareDocI");
var tmpArray = new Array("");
var cTerms = 0;
var dateFormatter = new java.text.SimpleDateFormat( "MM-dd-yyyy" );
if (sessionScope.numprenum) {
tmpArray[cTerms++] = "(Field NumePrenume = \"*" + sessionScope.numprenum + "*\")";
}
if (sessionScope.postvizat) {
tmpArray[cTerms++] = "(Field PostulVizat = \"*" + sessionScope.postvizat + "*\")";
}
if (sessionScope.din && sessionScope.pana) {
tmpArray[cTerms++] = "Field _creationDate >= " + dateFormatter.format(sessionScope.din) + " AND Field _creationDate <= " + dateFormatter.format(sessionScope.pana);
}
filter = tmpArray.join(" AND ").trim();
var vec=vw.getAllDocumentsByKey(filter , true);
return vec.getCount();
这是我用来过滤视图的过滤器.我想将此代码添加到按钮中,如果结果为 0,那么它应该显示一个带有消息的对话框,而不是显示视图.
This is the filter I use to filter my view. I wanted to add this code to a button, and if the result is 0 then instead of showing the view, it should show a dialog with a message.
推荐答案
getAllDocumentsByKey
和 fTSearch
方法在视图上做不同的事情.您正在尝试返回第一列与您正在使用的全文搜索条件匹配的条目数.我怀疑该视图未按该标准分类.
getAllDocumentsByKey
and fTSearch
methods do different things on the view. You're trying to return the number of entries where the first column matches the full text search criteria you're using. I suspect the view is not categorised on that criteria.
这篇关于Xpages 在查看 FTSearch 后没有结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!