public static void main(String[] args) throws IOException {
File dir = new File(args[0]);
int bc = Integer.parseInt(args[1]);
NewPopularityIndex index = new NewPopularityIndex(dir);
InMemoryStorage ims = new InMemoryStorage(dir, true);
DynamicDataManager ddm = new DynamicDataManager(bc, dir);
Scanner in = new Scanner(System.in);
while (in.hasNextLine()) {
String line = in.nextLine();
if (line.startsWith("get ")) {
String idStr = line.substring(4);
DocId docId = new DocId(idStr);
System.out.println(ims.getDocument(idStr));
Boosts boosts = ddm.getBoosts(docId);
System.out.println("timestamp: " + boosts.getTimestamp());
for (int i = 0; i < bc; i++) {
System.out.println("var["+i+"]: " + boosts.getBoost(i));
}
System.out.println(ddm.getCategoryValues(docId));
} else {
List<String> suggestions = index.getMostPopular(line);
for (String sugg : suggestions) {
System.out.print(" * ");
System.out.println(sugg);