Paul, Here’s how I experimented with your example using Solr 5, using your data literally:
bin/solr start bin/solr create -c sections bin/post -c sections sections.cv sections.csv id,document_id,section,content_t A-0,A,0,apples oranges bananas pears A-1,A,1,apples oranges B-0,B,0,apples B-1,B,1,oranges bananas C-0,C,0,oranges C-1,C,1,bananas http://localhost:8983/solr/sections/select?q=apples&facet=on&facet.field=document_id&rows=0&facet.mincount=2&wt=ruby&indent=on {pes of 'responseHeader'=>{ 'status'=>0, 'QTime'=>0, 'params'=>{ 'q'=>'apples', 'facet.field'=>'document_id', 'indent'=>'on', 'facet.mincount'=>'2', 'rows'=>'0', 'facet'=>'on', 'wt'=>'ruby'}}, 'response'=>{'numFound'=>3,'start'=>0,'docs'=>[] }, 'facet_counts'=>{ 'facet_queries'=>{}, 'facet_fields'=>{ 'document_id'=>[ 'A',2]}, 'facet_dates'=>{}, 'facet_ranges'=>{}, 'facet_intervals'=>{}}} That answers the question you asked… which document_id’s match *both* sections. This assumes there are two sections (or more) for each “document_id”. This could be modeled other ways, and probably should be as there are likely other types of queries you want to make. Does that get you closer? — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com > On Apr 13, 2015, at 12:03 PM, Morris, Paul E. <pmor...@nsf.gov> wrote: > > Dear SOLR users, > > I've found some facet postings and Erik's old slides Venn diagram slides but > still can't figure out the query to do the following. > > "Find the Document_IDs where the word apples is mentioned in both <SECTION> > fields (each <Section> has its own unique ID <REFERENCE>)" > > An example XML is listed below. In this case, a query returning only > Document_ID A would be the desired response. > > I'm tying myself in knots trying to get this to work. > > With thanks, > > Paul > > > ------ example XML ------ > > <?xml version="1.0" encoding="UTF-8"?><DOCS> > <DOCUMENT> > <Document_ID>A</Document_ID> > <REFERENCE>A-0</REFERENCE> > <SECTION>0</SECTION> > <CONTENT> apples oranges bananas pears </CONTENT> > </DOCUMENT> > > <DOCUMENT> > <Document_ID>A</Document_ID> > <REFERENCE>A-1</REFERENCE> > <SECTION>1</SECTION> > <CONTENT> apples oranges </CONTENT> > </DOCUMENT> > > <DOCUMENT> > <Document_ID>B</Document_ID> > <REFERENCE>B-0</REFERENCE> > <SECTION>0</SECTION> > <CONTENT> apples </CONTENT> > </DOCUMENT> > > <DOCUMENT> > <Document_ID>B</Document_ID> > <REFERENCE>B-1</REFERENCE> > <SECTION>1</SECTION> > <CONTENT> oranges bananas </CONTENT> > </DOCUMENT> > > <DOCUMENT> > <Document_ID>C</Document_ID> > <REFERENCE>C-0</REFERENCE> > <SECTION>0</SECTION> > <CONTENT> oranges </CONTENT> > </DOCUMENT> > > <DOCUMENT> > <Document_ID>C</Document_ID> > <REFERENCE>C-1</REFERENCE> > <SECTION>1</SECTION> > <CONTENT> bananas </CONTENT> > </DOCUMENT> > </DOCS> > > >