开发者

Problem with jQuery autocomplete and lucene

I use jQuery autocomplete in a jsp and get my searchresults from a servlet, where a Lucene Index is searched against the given term that should be autocompleted. Thats the code of the autocomplete in the jsp:

$(document).ready(function() {
    $("#QRY_ItemQuickSearch_enc").a开发者_开发技巧utocomplete("<%=autoSuggestAction%>",
        {
            onItemSelect:selectItem,
            minChars:3,
            maxItemsToShow:10,
            cacheLength:10,
            matchSubset:10
        }
    );
});

The Servlet is called by the expression: autoSuggestAction.

Thats no problem so far.

My Index is very large and if i use for a special term (f.e: 123) where Lucene does not find anything, the function does not display anything (as wished). If i want to further type in the character "4", so the complete searchterm is now "1234", i also get no results (as predicted). Notice: the Search function repeats.

Now my concrete problem:

If i type a search string, which is a thousand times(or many more) in the index, Lucene cannot handle this query and throws an "TooManyClausesException". I kniow that I can increase the value for the Booleanquery, but that will cost too much memory. Instead I display a result, that is written back to the input field and shows the user to further define the searchstring. But if I now type a character into the input field, the autocomplete method is not called again. Can somebody help me in this case?


The original requester solved the problem by editing the "requestData(q)" function in the source code of jquery.autocomplete.

He/she commented the line:

    if (data) { receiveData(q, data); } 

Now the search engine shows the desired results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜