lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Krugler <>
Subject Re: Autocompletion with Solritas
Date Fri, 18 Jun 2010 23:54:44 GMT
Hi Erik,

On Jun 17, 2010, at 8:34pm, Erik Hatcher wrote:

> Your wish is my command.  Check out trunk, fire up Solr (ant run- 
> example), index example data, hit http://localhost:8983/solr/browse  
> - type in search box.
> Just used jQuery's autocomplete plugin and the terms component for  
> now, on the name field.  Quite simple to plug in, actually.  Check  
> the commit diff.  The main magic is doing this:
>   <http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=i&terms.sort=count&wt=velocity&v.template=suggest

> >
> Stupidly, though, jQuery's autocomplete seems to be hardcoded to  
> send a q parameter, but I coded it to also send the same value as  
> terms.prefix - but this could be an issue if hitting a different  
> request handler where q is used for the actual query for filtering  
> terms on.

Let's say, just for grins, that a different field (besides "name") is  
being used for autocompletion.

What would be all the places I'd need to hit to change the field,  
besides the terms.fl value in layout.vm? For example, what about  

{selectedItemProp: "name", searchObjProps: "name"}});

I'm asking because I'm trying to use this latest support with an index  
that uses "product_name" for the auto-complete field, and I'm not  
getting any auto-completes happening.

I see from the Solr logs that requests being made to /solr/terms  
during auto-complete that look like:

INFO: [] webapp=/solr path=/terms  
status=0 QTime=0

Which I'd expect to work, but don't seem to be generating any results.

What's odd is that if I try curling the same thing:

curl -v "http://localhost:8983/solr/terms?limit=10&timestamp=1276903135595&terms.fl=product_name&q=rug&wt=velocity&terms.sort=count&v.template=suggest&terms.prefix=rug


I get an empty HTML response:

< Content-Type: text/html; charset=utf-8
< Content-Length: 0
< Server: Jetty(6.1.22)

If I just use what I'd consider to be the minimum set of parameters:

curl -v "http://localhost:8983/solr/terms?limit=10&terms.fl=product_name&q=rug&terms.sort=count&terms.prefix=rug


Then I get the expected XML response:

< Content-Type: text/xml; charset=utf-8
< Content-Length: 225
< Server: Jetty(6.1.22)
<?xml version="1.0" encoding="UTF-8"?>
<lst name="responseHeader"><int name="status">0</int><int  
name="QTime">0</int></lst><lst name="terms"><lst  
name="product_name"><int name="rug">7</int></lst></lst>

Any ideas what I'm doing wrong?


-- Ken

> On Jun 17, 2010, at 8:03 PM, Ken Krugler wrote:
>> I don't believe Solritas supports autocompletion out of the box.
>> So I'm wondering if anybody has experience using the LucidWorks  
>> distro & Solritas, plus the AJAX Solr auto-complete widget.
>> I realize that AJAX Solr's autocomplete support is mostly just  
>> leveraging the jQuery Autocomplete plugin, and hooking it up to  
>> Solr facets, but I was curious if there were any tricks or traps in  
>> getting it all to work.
>> Thanks,
>> -- Ken

Ken Krugler
+1 530-210-6378
e l a s t i c   w e b   m i n i n g

View raw message