ngram search within hieararchical data