The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

hanafey (18) [Avatar] Offline
Section 8.3 discusses highlighting and all the examples of the QueryScorer use provide the "field" parameter without any explaination. The JavaDoc on this parameter is also not very helpful.

It appears that if the intention is to highlight a single field, for efficiency this "field" parameter should be used, but if more than one field will be highlighted you have a choice of creating more than one QueryScorer for the different fields, or using a single instance with "field" set to null.

With minimal expansion, the book could clarify this issue.

In addition, for a field whose "Document.getValues(String field)" returns an array of length greater than one, how this case is highlighted would also be useful.
mike.mccandless (221) [Avatar] Offline
Re: Highlighter field argument
Indeed the "field" argument to QueryScorer is not well documented. It looks like, if you pass null, QueryScorer will derive the field name(s) from the Query, else it will use only the field name you provided. I'll add a sentence explaining this... but can you also open a Lucene issue to fix the javados? Thanks.

I'll also explain how multi-valued fields are handled -- they are logically concatenated, but, you have to ensure the token stream correctly implements endOffset().

Thanks for the feedback!