Last modified: 2014-02-21 23:03:55 UTC
See URL for exact search. In the result list only the second search term "Canada" is highlighted by the first search term "Spekking" (my name) is not visible. The search result itself is perfect. I expected the first 3 results at least :-)
I think there are two reasons the old search gets this more right: 1. Elasticsearch doesn't make any special effort to make sure that all search terms appear in the snippet (or snippets) it selects. I'll have a think about that. lsearchd doesn't make that effort either but in this case it gets lucky because the search terms only appear once in the wikitext. In a sense the wikitext is more information dense then the rendered output. In another sense, though, it throws away lots of information by not rendering templates. You win some and you lose some. In this case we lost. 2. lsearchd performs a neat trick: if it finds two worth while segments then it returns them otherwise it returns one double length segment. Elasticsearch doesn't have that bit of magic though for what it is worth I've proposed it: https://github.com/elasticsearch/elasticsearch/issues/3776 . I'm not sure it'd help without #1. In general you can't expect to get all the terms highlighted _but_ you can tell by playing with google that they've implemented both of these things.