Spellcheck in solr response

119 views
Skip to first unread message

Jeremy Nelson

unread,
Nov 18, 2011, 6:07:01 PM11/18/11
to Python Sunburnt
Hi,
I'm wondering if sunburnt supports the spellcheck directive in the
Solr requestHandler? I have spellcheck enabled for queries that don't
match any fields but I haven't been able to figure out to get at the
spellcheck in the SolrInterface.search's returned SolrResponse. For
example doing an author search for Darwin23 returns 0 hits but the raw
Solr response includes the spellcheck along with suggestions of
"darwin", "darwinism", "darwinian", "darwinist", and "garwin". Is this
not implemented yet?

Thanks,
Jeremy

Jeremy Nelson

unread,
Nov 21, 2011, 1:52:43 PM11/21/11
to Python Sunburnt
I just added a lightweight SolrSpellCheck class to a forked version of
sunburnt at https://github.com/jermnelson/sunburnt/. The SolrResponse
now has a spellcheck object that contains the miss-spelled term and a
list of suggestions. I have only done minimal testings and
implementation to support our academic library Django-based catalog
and any suggestions/comments would be great.

Thanks,
Jeremy

Rebecca K

unread,
Dec 1, 2011, 2:42:04 PM12/1/11
to python-...@googlegroups.com
Jeremy,

Adding support for solr spellcheck to sunburnt seems like it would be useful.  I haven't had the chance to use Solr's spell check functionality yet (although I may get the chance to start using it sometime soon).  Could you give an example of how you are using the spell check feature in your forked version of sunburnt, and how you might display the results?   It's not quite obvious to me from looking at the commit on your github fork.

Jeremy Nelson

unread,
Dec 2, 2011, 11:19:59 AM12/2/11
to Python Sunburnt
Hi Rebecca,
Here is an example from our public beta Discovery Layer:
http://discovery.coloradocollege.edu/catalog/search?q=george12&search-type=author_search

I implemented our main specialized search types (Author, Title,
Subject) with sunburnt using the new spell-check functionality. I
created a custom Django template tag to display this listing of solr's
suggestions. Below are the relevant links to the Django template and
templatetags from aristotle.
https://github.com/jermnelson/Discover-Aristotle/blob/master/aristotle/templates/discovery/index.html
https://github.com/jermnelson/Discover-Aristotle/blob/master/aristotle/templates/discovery/snippets/spellcheck.html
https://github.com/jermnelson/Discover-Aristotle/blob/master/aristotle/apps/discovery/templatetags/discovery_extras.py

Hope this helps.

Rebecca K

unread,
Dec 6, 2011, 4:19:43 PM12/6/11
to python-...@googlegroups.com
Jeremy, that looks pretty slick.  Thanks for the example and links.

Are you generating the spellcheck query through sunburnt? Are there any options that have to be specified in the query generated by sunburnt, or is it all just a matter of configuring things on the Solr end? 

In my experience, Toby has been pretty receptive to pull requests on github, particularly if code includes documentation and tests - so you might think about adding docs & tests and sending a pull request; this seems like something that would be pretty useful.

Jeremy Nelson

unread,
Dec 6, 2011, 6:53:55 PM12/6/11
to Python Sunburnt
Thanks Rebecca,
No, you don't have to specify anything special on the sunburnt query
or search method call, it is grabbed from the Solr response and added
to the SolrResponse object. All of the configuration is done on the
Solr end. I'll go ahead and add the documentation and tests and then
send a pull request.

kaya...@gmail.com

unread,
Sep 13, 2013, 11:16:04 AM9/13/13
to python-...@googlegroups.com
Jeremy this is an old thread, I was wondering if you are still working on this project and if so have you sent the pull request.
Reply all
Reply to author
Forward
0 new messages