Highlighting in full-text search

Hector Castro hector at basho.com
Thu May 1 16:19:12 EDT 2014


Hi Chaim,

In order to take advantage of the Riak Search/Solr highlighting
capabilities from Python (right now), you're best bet may be to use a
Python Solr client for queries. The Riak client for Python is still not
100% compatible with Riak 2.0 (although the master branch has some
support). [0]

Using the examples provided in the basic usage for search documentation
[1], I was able to retrieve highlighting snippets via HTTP using the
following set of query string parameters:

$ curl -s
"$RIAK_HOST/search/famous?wt=json&hl=true&hl.fl=name_s&q=name_s:Lion*" |
python -mjson.tool | grep -A6 "highlighting"
    "highlighting": {
        "default_yzbucket_liono_54": {
            "name_s": [
                "<em>Lion-o</em>"
            ]
        }
    },

(Note the <em> tags surrounding the term that matches the query.)

--
Hector

[0] https://github.com/basho/riak-python-client
[1] http://docs.basho.com/riak/2.0.0beta1/dev/using/search/

On Thu, May 1, 2014 at 5:02 AM, Chaim Solomon <chaim at itcentralstation.com>
wrote:
> Hi,
>
> I am not able to figure out how to get the highlighting to work.
> I am using 2.0.0beta1 which states that it supports highlighting - but it
> seems not really documented besides the reference to the Solr
documentation.
> I am using the Python client.
>
> The documentation states that I need to set hl=true. But where?
> It doesn't seem to be one of the parameters that the method search accepts
> (looked in the source code).
>
> How do I get that parameter into the search?
>
> Can anyone provide an example?
>
> Chaim Solomon
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140501/2c515cdf/attachment.html>


More information about the riak-users mailing list