2
votes

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").autocomplete("<%=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?

1
I solved the problem. I edited the "requestData(q)" function in the source code of jquery.autocomplete. I inserted comments to the lines if (data) { receiveData(q, data); } Now my search engine shows the desired results. Cyauser397741
Good that you found a solution. You should post it as an answer and accept it. Otherwise this question will look unresolved.ponzao

1 Answers

0
votes

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.