void btnGetResultForTrecEval_Click(object sender, EventArgs e) { // load index for search IndexStorage textCaptionIndexStorage = new IndexStorage(ConfigCommon.CAPTION_INDEX_STORAGE); textCaptionIndexStorage.OpenIndexStore(); // read queries Dictionary <string, string> dicQueries = ReadTopicFile(ConfigEvaluation.topicFile); foreach (var item in dicQueries) { Console.WriteLine(string.Format("'{0}'", item.Value)); } // search for each query FileStream fs = File.Create(ConfigEvaluation.resultsFile); fs.Close(); StreamWriter sw = new StreamWriter(ConfigEvaluation.resultsFile); foreach (var query in dicQueries) { // example: 301 Q0 FR940202-2-00150 104 2.129133 STANDARD List <float> listScores; List <Object> listTextCaptions = Searching.SearchByQueryPlusScore(textCaptionIndexStorage, ConfigCommon.TOP_RANK, query.Value, SearchType.CAPTION, out listScores); if (listTextCaptions == null) { sw.Write(query.Key + "\tQ0\tNULL\tNULL\tNULL\tNULL\n"); continue; } HashSet <string> hsDocRetrieval = new HashSet <string>(); List <float> listScoresNew = new List <float>(); for (int i = 0; i < listTextCaptions.Count; i++) { string docRetrieval = GetDocRetrieval(((TextCaption)listTextCaptions[i]).FrameName); if (!hsDocRetrieval.Contains(docRetrieval)) { hsDocRetrieval.Add(docRetrieval); listScoresNew.Add(listScores[i]); } if (hsDocRetrieval.Count == numNumberOfTopGet.Value) { break; } } for (int i = 0; i < hsDocRetrieval.Count; i++) { //string docRelevanced = GetDocRelevanced(((TextCaption)listTextCaptions[i]).FrameName); string record = string.Format("{0}\tQ0\t{1}\t{2}\t{3}\tRUN_0", query.Key, hsDocRetrieval.ElementAt(i), (i + 1), listScoresNew[i]); //Console.WriteLine(record); sw.Write(record + "\n"); } Console.WriteLine(query.Key); } sw.Close(); Console.WriteLine("Finish"); }