Ejemplo n.º 1
0
        public void GetTermVectors()
        {
            AddDocument(new TermVectorDoc { Content = "car truck boat train trucks", NoTerms = "no term analysis for this field."});

            var mapper = new TermFreqVectorDocumentMapper<TermVectorDoc>(Version.LUCENE_30);

            var doc = provider.AsQueryable(mapper).Single();

            var termFreqVectors = mapper[doc];
            Assert.That(termFreqVectors, Is.Not.Null);
            Assert.That(termFreqVectors.Length, Is.EqualTo(1));

            var termFreqVector = termFreqVectors[0];

            Assert.That(termFreqVector, Is.Not.Null);
            Assert.That(termFreqVector.Field, Is.EqualTo("Content"));
            Assert.That(termFreqVector.GetTerms(), Is.EqualTo(new[] {"boat", "car", "train", "truck"}));
            Assert.That(termFreqVector.GetTermFrequencies(), Is.EqualTo(new[] {1, 1, 1, 2}));
        }
Ejemplo n.º 2
0
        public void GetTermVectors()
        {
            AddDocument(new TermVectorDoc {
                Content = "car truck boat train trucks", NoTerms = "no term analysis for this field."
            });

            var mapper = new TermFreqVectorDocumentMapper <TermVectorDoc>(Version.LUCENE_30);

            var doc = provider.AsQueryable(mapper).Single();

            var termFreqVectors = mapper[doc];

            Assert.That(termFreqVectors, Is.Not.Null);
            Assert.That(termFreqVectors.Length, Is.EqualTo(1));

            var termFreqVector = termFreqVectors[0];

            Assert.That(termFreqVector, Is.Not.Null);
            Assert.That(termFreqVector.Field, Is.EqualTo("Content"));
            Assert.That(termFreqVector.GetTerms(), Is.EqualTo(new[] { "boat", "car", "train", "truck" }));
            Assert.That(termFreqVector.GetTermFrequencies(), Is.EqualTo(new[] { 1, 1, 1, 2 }));
        }