I am indexing articles in lucene index through different fields i.e. title, description, link, publishDate
I query the index using MultiFieldQueryParser like
+(title:[text]^5.0 description:[text]^4.0 link:[text]^3.0) +publishDate:[20150101 TO 20150531]
and then i show the articles as the search results. So far all is good. Now I want to highlight the search text in the title,description
How shall i go about this?
The normal Highlighter gives me NullPointerException while generrating fragments.
and PostingHighlighter gives me a Map with results grouped together according to the field.. but i don't want it that way. I was the entire document to be returned together with highlighting of search text in title and description.
Any help or suggestion or code snippet is appreciated..
I got it working by using the
FieldTypefor all the fields that I wanted highlighted: