public void generateSearchResults(){
        irLists = new ArrayList<IRList>();
        q = queryParser.nextQuery();

//        while (q != null){
//            ArrayList<DocScore> docScores = iRmodel.getRanking(q.toQueryHash());
//                            PageRank pageRank = new PageRank();
//                        pageRank.setNSeed(nSeed);
//                        pageRank.setNPointed(nPointed);
//                        pageRank.setIndex(index);
//                        pageRank.setNIteration(nIteration);
//            pageRank.setDocScores(docScores);
//            pageRank.run();
//            System.out.println("Done!");
//            docScores = pageRank.getRanking();
//
//            ArrayList<Integer> docs = new ArrayList<Integer>();
//            for (DocScore docScore : docScores) {
//                docs.add((int) docScore.doc);
//            }
//            irLists.add(new IRList(q, docs));
//            q = queryParser.nextQuery();
//        }

        // Multi-thread
        ArrayList<Thread> threads = new ArrayList<Thread>();
        final ArrayList<Query> queries = new ArrayList<Query>();
        while (q != null){
            queries.add(q);

            q = queryParser.nextQuery();
        }
        final ArrayList<RandomWalk> randomWalks = new ArrayList<RandomWalk>();
        for (int i = 0; i < queries.size(); i++){
            RandomWalk randomWalk;
            if (randomWalkMode == 0)
                randomWalk = new PageRank();
            else
                randomWalk = new HITS();

            randomWalk.setNSeed(nSeed);
            randomWalk.setNPointed(nPointed);
            randomWalk.setIndex(index);
            randomWalk.setNIteration(nIteration);
            randomWalks.add(randomWalk);
        }

        for (int i = 0; i < queries.size(); i++){
            final int finalI = i;
            Thread t = new Thread(){
                public void run(){
                    ArrayList<DocScore> docScores = iRmodel.getRanking(queries.get(finalI).toQueryHash());
                    if (randomWalkMode != -1){
                        RandomWalk randomWalk = randomWalks.get(finalI);
                        randomWalk.setDocScores(docScores);
                        randomWalk.run();
                        docScores = randomWalk.getRanking();
                    }
                    ArrayList<Integer> docs = new ArrayList<Integer>();
                    for (DocScore docScore : docScores) {
                        docs.add((int) docScore.doc);
                    }
                    irLists.add(new IRList(queries.get(finalI), docs));
                }
            };
            threads.add(t);
            t.start();
        }
        for (Thread t : threads){
            try {
                t.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        saveResults();
    }