Generic Framework of Subsequence Retrieval