Exemplo n.º 1
0
        /// <summary>
        /// Report a search result for a certain quality query.
        /// </summary>
        /// <param name="qq">quality query for which the results are reported.</param>
        /// <param name="td">search results for the query.</param>
        /// <param name="docNameField">stored field used for fetching the result doc name.</param>
        /// <param name="searcher">index access for fetching doc name.</param>
        /// <see cref="IOException">in case of a problem.</see>
        public virtual void Report(QualityQuery qq, TopDocs td, string docNameField, IndexSearcher searcher)
        {
            if (logger == null)
            {
                return;
            }
            ScoreDoc[]       sd  = td.ScoreDocs;
            string           sep = " \t ";
            DocNameExtractor xt  = new DocNameExtractor(docNameField);

            for (int i = 0; i < sd.Length; i++)
            {
                string docName = xt.DocName(searcher, sd[i].Doc);
                logger.WriteLine(
                    qq.QueryID + sep +
                    "Q0" + sep +
                    Format(docName, 20) + sep +
                    Format("" + i, 7) + sep +
                    //nf.format(sd[i].score) + sep +
                    string.Format(nf, sd[i].Score, CultureInfo.InvariantCulture) + sep +
                    name
                    );
            }
        }
Exemplo n.º 2
0
 public StoredFieldVisitorAnonymousHelper(DocNameExtractor outerInstance, IList <string> name)
 {
     this.outerInstance = outerInstance;
     this.name          = name;
 }