Lucene.Net.Search.Function.TestCustomScoreQuery.TestCustomExternalQuery C# (CSharp) Method

TestCustomExternalQuery() private method

private TestCustomExternalQuery ( ) : void
return void
        public void TestCustomExternalQuery() 
        {
            QueryParser qp = new QueryParser(Util.Version.LUCENE_CURRENT,TEXT_FIELD,anlzr); 
            String qtxt = "first aid text"; // from the doc texts in FunctionQuerySetup.
            Query q1 = qp.Parse(qtxt); 
        
            Query q = new CustomExternalQuery(q1);
            Log(q);

            IndexSearcher s = new IndexSearcher(dir);
            TopDocs hits = s.Search(q, 1000);
            Assert.AreEqual(N_DOCS, hits.TotalHits);
            for(int i=0;i<N_DOCS;i++) 
            {
                int doc = hits.ScoreDocs[i].Doc;
                float score = hits.ScoreDocs[i].Score;
                Assert.AreEqual(score, (float)1 + (4 * doc) % N_DOCS, 0.0001, "doc=" + doc);
            }
            s.Close();
        }