On Tue, Oct 04, 2011 at 08:13:04AM +0200, goran kent wrote: > On Tue, Oct 4, 2011 at 5:26 AM, Marvin Humphrey <[email protected]> > wrote: > >> If so, feature request: my @field_hit = $hits->relevant_field() would > >> be really nice ;) > > > Peter has provided one vision, in SWISH::Prog::Lucy::Results. I confess > > that > > I don't quite understand what you've shown us above. Can you provide some > > context illustrating how it would be used? > > Sorry, is that last Q directed at me, or Peter? If me, then > @field_hit would contain my list of 'field' names in which the search > terms were found, allowing me to do my thang.
OK, I think I basically understand. Hits is an iterator, though, and the fields which contributed to the score can vary per-document, so I think this would have to be a property of the HitDoc (which happens to be how Peter has done things). However, I don't think it's ideal for Hits to provide an API which only works when the user has specified an unrelated, unintuitive schema setting. Why does this functionality have anything to do with highlighting? And the granularity of 'highlightable' is per-field, while we need it to be on for *all* indexed fields if we're to get a meaningful answer out of relevant_fields(). Perhaps there ought to be something like an index-wide attribute on Schema which triggers the creation of single-document inverted indexes which includes all indexed fields? Until such high-level design issues are worked out, if we decide that there's a pressing need for this feature, I'd rather see it in a LucyX class that wraps Hits. > Is it safe to change the schema so that my 'inbound_text' field is > highlightable (currently OFF)? - ie, there will be a mixture of the > 'inbound_text' field in various indexes (which will end up being > merged to large searchable indexes) with/without highlightable being > ON. No, that will cause a schema conflict exception; existing documents would not have highlighting data available for that field, and the setting applies to all segments. It will be necessary to regenerate. Marvin Humphrey
