public void ResultTransformToDelimString()
        {
            IFullTextSession s = Search.CreateFullTextSession(this.OpenSession());

            this.PrepEmployeeIndex(s);

            s.Clear();
            ITransaction tx     = s.BeginTransaction();
            QueryParser  parser = new QueryParser(NHibernate.Search.Environment.LuceneVersion, "Dept", new StandardAnalyzer(NHibernate.Search.Environment.LuceneVersion));

            Query          query    = parser.Parse("Dept:ITech");
            IFullTextQuery hibQuery = s.CreateFullTextQuery(query, typeof(Employee));

            hibQuery.SetProjection(
                "Id",
                "Lastname",
                "Dept",
                ProjectionConstants.THIS,
                ProjectionConstants.SCORE,
                ProjectionConstants.BOOST,
                ProjectionConstants.ID);
            hibQuery.SetResultTransformer(new ProjectionToDelimStringResultTransformer());

            IList result = hibQuery.List();

            Assert.IsTrue(((string)result[0]).StartsWith("1000, Griffin, ITech"), "incorrect transformation");
            Assert.IsTrue(((string)result[1]).StartsWith("1002, Jimenez, ITech"), "incorrect transformation");

            // cleanup
            s.Delete("from System.Object");
            tx.Commit();
            s.Close();
        }
        public void ResultTransformMap()
        {
            IFullTextSession s = Search.CreateFullTextSession(this.OpenSession());

            this.PrepEmployeeIndex(s);

            s.Clear();
            ITransaction tx     = s.BeginTransaction();
            QueryParser  parser = new QueryParser(NHibernate.Search.Environment.LuceneVersion, "Dept", new StandardAnalyzer(NHibernate.Search.Environment.LuceneVersion));

            Query          query    = parser.Parse("Dept:ITech");
            IFullTextQuery hibQuery = s.CreateFullTextQuery(query, typeof(Employee));

            hibQuery.SetProjection(
                "Id",
                "Lastname",
                "Dept",
                ProjectionConstants.THIS,
                ProjectionConstants.SCORE,
                ProjectionConstants.BOOST,
                ProjectionConstants.DOCUMENT,
                ProjectionConstants.ID);
            hibQuery.SetResultTransformer(new ProjectionToMapResultTransformer());

            IList transforms = hibQuery.List();
            Dictionary <string, object> map = (Dictionary <string, object>)transforms[1];

            Assert.AreEqual("ITech", map["Dept"], "incorrect transformation");
            Assert.AreEqual(1002, map["Id"], "incorrect transformation");
            Assert.IsTrue(map[ProjectionConstants.DOCUMENT] is Document, "incorrect transformation");
            Assert.AreEqual(
                "1002",
                ((Document)map[ProjectionConstants.DOCUMENT]).GetField("Id").StringValue,
                "incorrect transformation");

            // cleanup
            s.Delete("from System.Object");
            tx.Commit();
            s.Close();
        }