public void doubleWordSearch(String query) throws Exception {
        String[] line = query.split(" ");
        Set<Integer> result = new HashSet();
        
        if (line.length == 0) {
            System.out.println("Try another query");
            System.exit(0);
        } else if(line.length == 1) {
             boolSearch(query);
        } else {
            if (doubleWordIndex.containsKey(line[0]+" "+line[1]))
                result = doubleWordIndex.get(line[0]+" "+line[1]);
            for (int i = 1; i<line.length; i++) {
                if (i+1 < line.length) {
                    if (doubleWordIndex.containsKey(line[i]+" "+line[i+1]))
                        result.retainAll(doubleWordIndex.get(line[i]+" "+line[i+1]));
                }
            }
        
            System.out.println("Query: " + query);
            System.out.println("Result: ");
            for (Integer docId: result) {
                System.out.println(getDocName(docId));
            }  
        }   
    }