public static void main(String[] args) {
        if (args.length != 1) {
            System.out.println("There are not enough parameters: " + args.length);
            System.out.println("Single parameter should specify path to index");
            return;
        }

        SearchEngine searchEngine = buildSearchEngine(args[0]);
        if (searchEngine == null) {
            return;
        }

        Scanner scanner = new Scanner(System.in);
        while (true) {
            try {
                SearchQuery query = (QueryParser.INSTANCE).parse(scanner.nextLine());
                DocumentCollection result = searchEngine.search(query);
                System.out.println(result);
            } catch (ErrorParsingException e) {
                System.out.println(e.getMessage());
            }
        }

    }