我正在尝试使用其search
属性过滤viewPanel。 viewPanel没有任何分类列。
这些文档使用的是读者和作者字段。一个问题是我在表示“隐藏”文档的视图中得到一些空行。
过滤器输入字段全部包含在Doc中。类型,以及响应类型。
var tmpArray = new Array("");
var cTerms = 0;
var dateFormatter = new java.text.SimpleDateFormat( "MM-dd-yyyy" );
if (sessionScope.compA) {
tmpArray[cTerms++] = "(Field Comp = \"*" + sessionScope.compA + "*\")";
tmpArray[cTerms++] = "(Field Compania = \"*" + sessionScope.compA + "*\")";
/* Comp - the field from Doc. & Compania - the field from Response */
}
if (sessionScope.numePro) {
tmpArray[cTerms++] = "(Field NumeProiect = \"*" + sessionScope.numePro + "*\")";
tmpArray[cTerms++] = "(Field Proiect = \"*" + sessionScope.numePro + "*\")";
/* NumeProiect - the field from Doc. & Proiect - the field from Response */
}
if (sessionScope.din && sessionScope.pana) {
tmpArray[cTerms++] = "Field _creationDate >= " + dateFormatter.format(sessionScope.din) + " AND Field _creationDate <= " + dateFormatter.format(sessionScope.pana);
}
qstring = tmpArray.join(" OR ").trim();
sessionScope.queryString = qstring;
return qstring
但是我没有得到预期的结果,我确实得到了类似:sessionScope.compA的正确文档,但是如果我为第二个sessionScope.numePro添加一个值,该值不包含在由查看,结果是一样的,应该没有结果。
我怎样才能做到这一点?
答案 0 :(得分:1)
我猜你只是混淆了ftsearch部分之间的逻辑连接。以下代码适合您:
var tmpArray = new Array("");
var cTerms = 0;
var dateFormatter = new java.text.SimpleDateFormat( "MM-dd-yyyy" );
if (sessionScope.compA) {
tmpArray[cTerms++] = "((Field Comp = \"*" + sessionScope.compA + "*\") OR " +
"(Field Compania = \"*" + sessionScope.compA + "*\"))";
/* Comp - the field from Doc. & Compania - the field from Response */
}
if (sessionScope.numePro) {
tmpArray[cTerms++] = "((Field NumeProiect = \"*" + sessionScope.numePro + "*\") OR " +
"(Field Proiect = \"*" + sessionScope.numePro + "*\"))";
/* NumeProiect - the field from Doc. & Proiect - the field from Response */
}
if (sessionScope.din && sessionScope.pana) {
tmpArray[cTerms++] = "Field _creationDate >= " + dateFormatter.format(sessionScope.din) +
" AND Field _creationDate <= " + dateFormatter.format(sessionScope.pana);
}
qstring = tmpArray.join(" AND ").trim();
sessionScope.queryString = qstring;
return qstring