Yonik Seeley wrote: > On 8/16/07, Alf Eaton <[EMAIL PROTECTED]> wrote: >> On 16 Aug 2007, at 17:20, Alf Eaton wrote: >> >>> When searching a multiValued field, is it possible to know which of >>> the multiple fields the match was in? >>> >>> For example if I have an index of documents, each of which has >>> multiple image captions stored in separate fields, I'd like to be >>> able to link from the search results to the caption in the original >>> document. >>> >>> One possibility could be attaching metadata to a field, similar to >>> payloads for terms. At the moment all I can think of is adding >>> metadata inside the stored field and stripping that out when it's >>> indexed and displayed, but that's not ideal. >> Actually on reflection all this would need would be for the >> Highlighter to add a field to the response, saying which item of the >> multiValued field the match was in. Is that possible? > > Could you perhaps index the captions as > #1 this is the first caption > #2 this is the second caption > > And then when just look for #n in the highlighted results? > For display, you could also strip out the #n in the captions. >
This was working ok for a while, but there's a problem: the highlighter doesn't return the whole caption - just the highlighted part - so sometimes the #n at the start of the caption field doesn't get returned and isn't available. Any other ideas? Perhaps there's a way for the response to say which fields of each document were matched? alf