Looks like a typo below, Chantal, and another comment below too...

On Jun 18, 2010, at 3:32 AM, Chantal Ackermann wrote:
$(function() {
        $("#qterm").autocomplete('/solr/epg/suggest', {
                extraParams: {
                        'terms.prefix': function() { return $("#qterm").val(); }
                },
                hightlight: false,

hightlight?  highlight :)

                parse: function(data) {
                        var json =  jQuery.secureEvalJSON(data);
                        var terms = json.terms;
                        var suggMap = terms[1];
                        var suggest = [];
                        var j = 0;
                        for (i=0; i<suggMap.length; i=i+2) {
                                suggest[j] = {
                                        data: suggMap[i],
                                        value: suggMap[i],
                                        result: suggMap[i]
                                }
                                j = j+1;
                        }

This is one of the beauties of the VelocityResponseWriter, freeing the client from having to deal with a Solr data structure. In my work, I did this:

<http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/conf/velocity/suggest.vm?view=markup >

This makes a terms component request like <http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=i&terms.sort=count&wt=velocity&v.template=suggest > return exactly what the suggest component likes natively, suggestions textually one per line:
   ipod
   in

        Erik

Reply via email to