0
 for (String column : searchCols) {
            for (String keyword : keywords) { 
                listAllSql.append(getDBColumnName(column));
                listAllSql.append(" like "); //like
                listAllSql.append("'%");     //'%vision%'
                listAllSql.append(keyword); 
                listAllSql.append("%'"); 
                listAllSql.append(" or ");
            }

Here is a snippet of of the code. I pass a keyword for example "Networks" to be searched for. I want the statement to return me result event if it finds "Network" (Singular) as well as those which contains "Networks" (plural). What changes to do I make to the above statement to achieve this. I am actually working with 'SQLite' Manager as an add on on Mozilla Firefox FYI.

4

1 回答 1

0

您可以添加到顶部(不确定语言):

for (String keyword : keywords) { 
    if right(keyword,1) = "s" and length(keyword) > 1 then
        keyword = left(keyword,length(keyword)-1)
    end if
    listAllSql.append.....

您可能会遇到问题,他们搜索“as”并返回所有包含“a”的单词,但查找复数单词而不只是以 s 结尾的单词会困难得多,通常搜索中的误报也比误报要好(在我看来)。

于 2013-02-27T12:02:56.560 回答