You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ken Krugler <kk...@transpac.com> on 2010/06/18 02:03:45 UTC
Autocompletion with Solritas
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
Re: Autocompletion with Solritas
Posted by Erik Hatcher <er...@gmail.com>.
Yup, that's basically what I've done too, here's the script part:
<http://svn.apache.org/viewvc/lucene/dev/trunk/solr/example/solr/conf/velocity/layout.vm?view=markup
>
I didn't touch the example solrconfig, though putting the params in
the request handler is the better way, as you have.
Erik
On Jun 18, 2010, at 3:32 AM, Chantal Ackermann wrote:
> Hi,
>
> here is my solution. It has been some time since I last looked at it,
> but it works fine. :-)
>
> <script type="text/javascript"
> src="/solr/epg/admin/file?file=/velocity/
> jquery-1.4.min.js&contentType=text/javascript"></script>
> <script type="text/javascript"
> src="/solr/epg/admin/file?file=/velocity/jquery-
> ui.js&contentType=text/javascript"></script>
> <script type="text/javascript"
> src="/solr/epg/admin/file?file=/velocity/
> jquery.autocomplete.js&contentType=text/javascript"></script>
> <link rel="stylesheet" type="text/css"
> href="/solr/epg/admin/file?file=/velocity/
> jquery.autocomplete.css&contentType=text/css"/>
>
> <script type="text/javascript"
> src="/solr/epg/admin/file?file=/velocity/
> jquery.json-2.2.min.js&contentType=text/javascript"></script>
>
> $(function() {
> $("#qterm").autocomplete('/solr/epg/suggest', {
> extraParams: {
> 'terms.prefix': function() { return $("#qterm").val(); }
> },
> hightlight: false,
> max: 30,
> formatItem: function(row, i, n) {
> return row;
> },
> 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;
> }
>
> return suggest;
> }
> });
> });
>
> #qterm is the form's input text field.
> in solrconfig.xml:
>
> <requestHandler name="/suggest" class="solr.SearchHandler" >
> <lst name="defaults">
> <str name="echoParams">explicit</str>
> <bool name="terms">true</bool>
> <bool name="terms.lower.incl">false</bool>
> <str name="wt">json</str>
> <str name="terms.fl">suggestsrc</str>
> </lst>
> <arr name="components">
> <str>terms</str>
> </arr>
> </requestHandler>
>
> suggestsrc is of type solr.TextField, accumulated from different
> source
> fields.
>
> Cheers,
> Chantal
>
Re: Autocompletion with Solritas
Posted by Chantal Ackermann <ch...@btelligent.de>.
Hi Erik,
thanks so much for your feedback!
>
> hightlight? highlight :)
ups...
Seems that this parameter is false by default, though. At least it never
complained. *g*
> 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
I am beginning to understand what you mean. I haven't had a look at your
suggest template, so far. But I definitely will.
Thanks again!
Chantal
Re: Autocompletion with Solritas
Posted by Erik Hatcher <er...@gmail.com>.
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
Re: Autocompletion with Solritas
Posted by Chantal Ackermann <ch...@btelligent.de>.
Hi,
here is my solution. It has been some time since I last looked at it,
but it works fine. :-)
<script type="text/javascript"
src="/solr/epg/admin/file?file=/velocity/jquery-1.4.min.js&contentType=text/javascript"></script>
<script type="text/javascript"
src="/solr/epg/admin/file?file=/velocity/jquery-ui.js&contentType=text/javascript"></script>
<script type="text/javascript"
src="/solr/epg/admin/file?file=/velocity/jquery.autocomplete.js&contentType=text/javascript"></script>
<link rel="stylesheet" type="text/css"
href="/solr/epg/admin/file?file=/velocity/jquery.autocomplete.css&contentType=text/css"/>
<script type="text/javascript"
src="/solr/epg/admin/file?file=/velocity/jquery.json-2.2.min.js&contentType=text/javascript"></script>
$(function() {
$("#qterm").autocomplete('/solr/epg/suggest', {
extraParams: {
'terms.prefix': function() { return $("#qterm").val(); }
},
hightlight: false,
max: 30,
formatItem: function(row, i, n) {
return row;
},
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;
}
return suggest;
}
});
});
#qterm is the form's input text field.
in solrconfig.xml:
<requestHandler name="/suggest" class="solr.SearchHandler" >
<lst name="defaults">
<str name="echoParams">explicit</str>
<bool name="terms">true</bool>
<bool name="terms.lower.incl">false</bool>
<str name="wt">json</str>
<str name="terms.fl">suggestsrc</str>
</lst>
<arr name="components">
<str>terms</str>
</arr>
</requestHandler>
suggestsrc is of type solr.TextField, accumulated from different source
fields.
Cheers,
Chantal
Re: Autocompletion with Solritas
Posted by Ken Krugler <kk...@transpac.com>.
You, sir, are on my Christmas card list.
I'll fire it up tomorrow morning & let you know how it goes.
-- Ken
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.
>
> Cool?! I think so! :)
>
> Erik
>
>
> 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
>>
>>
>>
>>
>
--------------------------------------------
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
Re: Autocompletion with Solritas
Posted by Ken Krugler <kk...@transpac.com>.
Hi Erik,
On Jun 18, 2010, at 6:58pm, Erik Hatcher wrote:
> Have a look at suggest.vm - the "name" field is used in there too.
> Just those two places, layout.vm and suggest.vm.
That was the missing change I needed.
Thanks much!
-- Ken
> 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
>> ×tamp
>> =
>> 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×tamp=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
Re: Autocompletion with Solritas
Posted by Erik Hatcher <er...@gmail.com>.
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
> ×tamp
> =
> 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×tamp=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
>
>
>
>
Re: Autocompletion with Solritas
Posted by Ken Krugler <kk...@transpac.com>.
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
×tamp
=
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×tamp=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
Re: Autocompletion with Solritas
Posted by Erik Hatcher <er...@gmail.com>.
On Jun 18, 2010, at 2:56 PM, Ken Krugler wrote:
> 3. I tried "ant create-package" from trunk/solr, and got this error
> near the end:
>
>> /Users/kenkrugler/svn/lucene/lucene-trunk/solr/common-build.xml:
>> 252: /Users/kenkrugler/svn/lucene/lucene-trunk/solr/contrib/
>> velocity/src not found.
>
> I don't see contrib/velocity anywhere in the Lucene trunk tree.
I've removed the velocity cruft that was left in the build for
mavenization.
But I personally can't get create-package to run successfully locally,
it ends with this:
create-package:
[delete] Deleting: /Users/erikhatcher/dev/solucene/solr/dist/
apache-solr-4.0-dev.tgz
[tar] Building tar: /Users/erikhatcher/dev/solucene/solr/dist/
apache-solr-4.0-dev.tgz
BUILD FAILED
/Users/erikhatcher/dev/solucene/solr/build.xml:715: Problem creating
TAR: Input/output error
Anyone else experience that? Or have it run successfully?
Erik
Re: Autocompletion with Solritas
Posted by Erik Hatcher <er...@gmail.com>.
On Jun 18, 2010, at 2:56 PM, Ken Krugler 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.
>
> That works - excellent!
>
> Now I'm trying to build a distribution from trunk that I can use for
> prototyping, and noticed a few things...
>
> 1. From a fresh check-out, you can't build from the trunk/solr sub-
> dir due to dependencies on Lucene classes. Once you've done a top-
> level "ant compile" then you can cd into /solr and do ant builds.
sigh. Hopefully we'll shake these things out better over time. This
is just one of the growing pains of the lucene/solr merge.
> 2. I noticed the run-example target in trunk/solr/build.xml doesn't
> have a description, so it doesn't show up with ant -p.
Fixed. It was/is at least documented in the usage (just type ant).
> 3. I tried "ant create-package" from trunk/solr, and got this error
> near the end:
>
>> /Users/kenkrugler/svn/lucene/lucene-trunk/solr/common-build.xml:
>> 252: /Users/kenkrugler/svn/lucene/lucene-trunk/solr/contrib/
>> velocity/src not found.
>
> I don't see contrib/velocity anywhere in the Lucene trunk tree.
Ok, I'm looking into this and will clean it up. Darn you maven!
> What's the recommended way to build a Solr distribution from trunk?
Good question. Anyone...? :)
You've done it as I have, sorry for the too brief instructions earlier
- I have run "ant compile" from the top, but didn't realize it was
necessary first.
Erik
Re: Autocompletion with Solritas
Posted by Ken Krugler <kk...@transpac.com>.
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.
That works - excellent!
Now I'm trying to build a distribution from trunk that I can use for
prototyping, and noticed a few things...
1. From a fresh check-out, you can't build from the trunk/solr sub-dir
due to dependencies on Lucene classes. Once you've done a top-level
"ant compile" then you can cd into /solr and do ant builds.
2. I noticed the run-example target in trunk/solr/build.xml doesn't
have a description, so it doesn't show up with ant -p.
3. I tried "ant create-package" from trunk/solr, and got this error
near the end:
> /Users/kenkrugler/svn/lucene/lucene-trunk/solr/common-build.xml:
> 252: /Users/kenkrugler/svn/lucene/lucene-trunk/solr/contrib/velocity/
> src not found.
I don't see contrib/velocity anywhere in the Lucene trunk tree.
What's the recommended way to build a Solr distribution from trunk?
In the meantime I'll just use example/start.jar with solr.solr.home
and solr.data.dir system properties.
Thanks,
-- Ken
> 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.
>
> Cool?! I think so! :)
>
> Erik
>
>
> 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
--------------------------------------------
<http://ken-blog.krugler.org>
+1 530-265-2225
--------------------------------------------
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
Re: Autocompletion with Solritas
Posted by Erik Hatcher <er...@gmail.com>.
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.
Cool?! I think so! :)
Erik
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
>
>
>
>