You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Fielder, Todd Patrick" <tp...@sandia.gov> on 2015/04/30 20:48:52 UTC

highlighter/fragmenter question

Hello,
I'm not sure if this is the correct approach, so please let me know if there is a better way to accomplish the following task

I am attempting to search an entire database for a keyword.  To do this, I indexed all the data fields into a single "content" field with a delimiter between each field.  To search for a matching keyword, I need only to search the "content" field.  This works well...

I also want to highlight the field and display contextual data.  The problem is, the fragmenter slits the string into tokens based "fragmentSize" of the "content" field, which may split the string in the middle of a data field.  I would like the string to be tokenized by the fragmenter based on my delimiter.

I've looked at SimpleSpanFragmenter, but am not sure if that is the right class to use or how to configure it if it is, or if I should be modifying TokenStream or some other class to accomplish this.

Any help, ideas or links to tutorials/sample code would be greatly appreciated

Thanks in advance

-Todd