Article For
2.0 2.5 3.0 4.0 4.1 4.2 5.0 5.1 5.2

Session: Querying: How to use intersect?

To return only documents that match all provided sub-queries we have introduced intersect extension that enables us to do server-side intersection queries.


public IRavenQueryable<T> intersect();
Return Value
IRavenQueryable Instance implementing IRavenQueryable interface containing additional query methods.


// return all T-shirts that are manufactured by 'Raven'
// and contain both 'Small Blue' and 'Large Gray' types
QIntersection_TShirt t = QIntersection_TShirt.tShirt;
QIntersection_TShirtType tt = QIntersection_TShirtType.tShirtType;
List<TShirt> tshirts = session
  .query(TShirt.class, TShirts_ByManufacturerColorSizeAndReleaseYear.class)