← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Design a simple in-memory search indexing engine that supports three types of queries on a static collection of documents:
You will implement a class SearchIndexEngine with two public methods:
SearchIndexEngine(List<String> documents) constructs the engine from the provided documents. Each document is a string. Document IDs are the 0-based indices of the strings in the input list.List<Integer> search(String query, QueryType type) returns the list of document IDs that satisfy the query for the given type. The three enum values are SINGLE_WORD, MULTI_WORD, and SENTENCE. All searches are case-insensitive; both indexing and querying should treat uppercase and lowercase letters as the same.You may assume the documents contain only ASCII printable characters and spaces. Words are sequences of non-space characters separated by one or more spaces. The order of IDs in the returned list does not matter.