lucene-solr-user mailing list archives

Have a look at suggest.vm - the "name" field is used in there too.
Just those two places, layout.vm and suggest.vm. And I had already
added a ## TODO in my local suggest.vm:
## TODO: make this more generic, maybe look at the request terms.fl?
or just take the first terms field in the response?
And also, ideally, there'd be a /suggest handler mapped with the field
name specified there. I simply used what was already available to put
suggest in there easily.
Erik
On Jun 18, 2010, at 7:54 PM, Ken Krugler wrote:
> 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
> browse.vm:
>
> $("input[type=text]").autoSuggest("/solr/suggest",
> {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
> params
> =
> {limit
> =
> 10
> &timestamp
> =
> 1276903135595
> &terms
> .fl
> =
> product_name
> &q
> =
> rug
> &wt=velocity&terms.sort=count&v.template=suggest&terms.prefix=rug}
> 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"?>
> <response>
> <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>
> </response>
>
> Any ideas what I'm doing wrong?
>
> Thanks,
>
> -- 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
> http://bixolabs.com
> e l a s t i c w e b m i n i n g
>
>
>
>