Thank you so much for the quick reply, Erik. And wow: I didn't realize you
could use join that fluidly. Very nice.

Is there some trove of Solr doc that I'm missing where this natural syntax
is explained? I wouldn't have asked such a basic question except that I
found no evidence that this was possible.




On Wed, Jul 9, 2014 at 12:07 PM, Erik Hatcher <erik.hatc...@gmail.com>
wrote:

> Maybe something like q=*:* AND NOT {!join … } would do the trick?  (it’ll
> depend on your version of Solr for support of the {!…} more natural nested
> queries)
>
>         Erik
>
> On Jul 9, 2014, at 11:24 AM, Bruce Johnson <hbrucejohn...@gmail.com>
> wrote:
>
> > === Short-version ===
> > Is there a way to join on the complement of a query? I want the only the
> > Solr documents for which the nested join query does not match.
> >
> > === Longer-version ===
> > Query-time joins with {!join} are great at modeling the SQL equivalent of
> > patterns like this:
> >
> > SELECT book_name FROM books WHERE id
> > IN (SELECT book_id FROM chapters WHERE chapter_title = "Foo")
> >
> > This would find the name of books having chapters entitled "Foo".
> (Assuming
> > the chapters table have the column 'book_id' that point back to the book
> > record containing them.)
> >
> > That's great.
> >
> > Is there a way in Solr to query for the complement of that? In SQL terms,
> > this:
> >
> > SELECT book_name FROM books WHERE id
> > NOT IN (SELECT book_id FROM chapters WHERE chapter_title = "Foo")
> >
> > This would find books that do not have chapters entitled "Foo".
> >
> > It isn't the same as querying (in Solr terms) for something like
> >
> > {!join to=id from=book_id}-chapter_title:"Foo" // note the negation
> >
> > because it would still match other chapters in the same book that are not
> > entitled "Foo", causing the join to still identify the book based on its
> > other non-Foo chapters.
> >
> > Any advice would be greatly appreciated. I'm also open to other ways of
> > thinking about the problem. Perhaps there are alternative indexing
> patterns
> > that could accomplish the same goal.
> >
> > Many thanks,
> > Bruce
>
>

Reply via email to