Hi,

Been wrestling with a question on highlighting (or not) - perhaps
someone can help?

The question is this:
Is it possible, using highlighting or perhaps another more suited
component, to return words/tokens from a stored field based on a
regular expression's capture groups?

What I was kind of thinking would happen with highlighting regex
(hl.regex.pattern) - but doesn't seem to (although I am a highlighting
novice), is that capture groups specified in a regex would be
highlighted.

For example:
1) given a field called
    desc

2) with a stored value of:
    the quick brown fox jumps over the lazy dog

3) specify a regex of:
   .*quick\s(\S+)\sfox.+\sthe\s(\S+)\sdog.*

4) get in the response:
  <em>brown</em> and
  <em>lazy</em>
either as highlighting or through some other means.

(I find that using hl.regex.pattern on the above yields: <em>the quick
brown fox jumps over the lazy dog</em>)

I'm guessing that I'm misinterpreting the functionality offered by
highlighting, but I couldn't find much on the subject in the way of
usage docs.

I could write a custom highlighter or SearchComponent plugin that
would do this, but is there some mechanism out there that can do this
sort of thing already?
It wouldn't necessarily have to be based on regex, but regex tends to
be the de-facto standard for doing capture group token matching (not
sure how Solr syntax would do something similar unless there were
multiples, maybe?).

Any insights greatly appreciated.

Many thanks,
Peter

Reply via email to