private void saveResults(){
        // Save the result

        if (irLists == null)
            generateSearchResults();
        Writer writer = null;
        try{
            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resultFile), "utf-8"));
            for (IRList irList : irLists){
                writer.write('\n');
                writer.write("Query: " + irList.getQuery().id);
                writer.write('\n');
                ArrayList<Integer> pertinence = irList.getPertinence();
                ArrayList<Integer> relevants = irList.getQuery().relevants;
                writer.write("Relevants: ");
                //writer.write('\n');
                for (int relevant : relevants) {
                    writer.write(String.valueOf(relevant));
                    //writer.write(r);
                    writer.write('\t');
                }
                writer.write('\n');
                writer.write("Pertinences: ");
                //writer.write('\n');
                for (int i = 0; i < pertinence.size() && i < 10; i++){
                    writer.write(String.valueOf(pertinence.get(i)));
                    //writer.write(r);
                    writer.write('\t');
                }
                writer.write('\n');
            }

        } catch (Exception e){
            e.printStackTrace();
        } finally {
            try { if (writer != null) writer.close();} catch (Exception e) {}
        }

    }