From 05702c2ced40caac595b808a04f038d21798db4c Mon Sep 17 00:00:00 2001 From: luccioman Date: Fri, 30 Mar 2018 11:12:48 +0200 Subject: [PATCH] Adjusted api table query matching strategies When inlined (for example in the CrawlProfileEditor_p.html page) : search only on the comment, as the url is not visible On regular display : search on comment OR url, instead of comment AND url. Otherwise searching on comments terms is almost useless as these terms are not necessarily present in the url. --- htroot/Table_API_p.java | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.java index c70d8343b..06d4924fd 100644 --- a/htroot/Table_API_p.java +++ b/htroot/Table_API_p.java @@ -281,19 +281,36 @@ public class Table_API_p { // first prepare a list while (mapIterator.hasNext()) { r = mapIterator.next(); - if (r == null) continue; + if (r == null) { + continue; + } typeb = r.get(WorkTables.TABLE_API_COL_TYPE); - if (typeb == null) continue; + if (typeb == null) { + continue; + } type = UTF8.String(typeb); - if (!typefilter.matcher(type).matches()) continue; + if (!typefilter.matcher(type).matches()) { + continue; + } commentb = r.get(WorkTables.TABLE_API_COL_COMMENT); - if (commentb == null) continue; + if (commentb == null) { + continue; + } comment = UTF8.String(commentb); - if (!query.matcher(comment).matches()) continue; urlb = r.get(WorkTables.TABLE_API_COL_URL); - if (urlb == null) continue; + if (urlb == null) { + continue; + } url = UTF8.String(urlb); - if (!query.matcher(url).matches()) continue; + if(inline) { + if (!query.matcher(comment).matches()) { + /* When inlined, the url is not displayed so we search only on the comment */ + continue; + } + } else if (!query.matcher(comment).matches() && !query.matcher(url).matches()) { + /* The entry is evicted when both url and comment do not match the query */ + continue; + } if (matchCount >= startRecord && table.size() < maximumRecords) { table.add(r); }