Added special optimiser treatment for queries with two patterns.