lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Wartes <>
Subject Which fields matched?
Date Fri, 07 Dec 2012 16:59:25 GMT

If I have an arbitrarily complex query that uses ORs, something like:
q=(simple_fieldtype:foo OR complex_fieldtype:foo) AND (another_simple_fieldtype:bar OR another_complex_fieldtype:bar)

I want to know which fields actually contributed to the match for each document returned.
Something like:
docID=1, fields_matched=simple_fieldtype,complex_fieldtype,another_complex_fieldtype
docID=2, fields_matched=simple_fieldtype,another_complex_fieldtype

My basic use case is that I have several copyField'ed variations on the same data (using different
complex FieldTypes), and I want to know which variations contributed to the document so I
can conclude things like "Well, this document matched the field with the SynonymFilterFactory,
but not the one without, so this particular document must've been a synonym match."

I know you could probably lift this from debugQuery output, but that's a non-starter due to
parsing complexity and query performance impact.
I think you could edge into some of this using the HighlightComponent output, but that's a
non-starter because it requires fields be stored=true. Most of my fieldTypes are intended
solely for indexing/search, and make no sense from a stored/retrieval standpoint. And to be
clear, I really don't care about which terms matched anyway, only which fields.

If there's an easy way to get this, I'd love to hear it. Otherwise, I'm mostly looking for
a head start on where to go looking for this data so I can add my own Component or something
- assuming the data is even available in the solr layer?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message