Exemplo n.º 1
0
        public void ReturnsMatchingResults()
        {
            var node1 = new SuffixIndexNode {
                Term = "SomeTerm", ID = 1
            };
            var node2 = new SuffixIndexNode {
                Term = "AnotherTerm", ID = 2
            };
            var indexer = new SQLiteSuffixIndexer(Path.GetTempFileName());

            indexer.InitializeDB();

            indexer.AddToIndex(node1);
            indexer.AddToIndex(node2);

            Assert.AreEqual(1, indexer.Retrieve("eTerm").First().ID);
            Assert.AreEqual(1, indexer.Retrieve("eTerm").Count());
            Assert.AreEqual(2, indexer.Retrieve("rTerm").First().ID);
            Assert.AreEqual(1, indexer.Retrieve("rTerm").Count());
        }
Exemplo n.º 2
0
        public void CanAddInBatches()
        {
            var node1 = new SuffixIndexNode {
                Term = "SomeTerm", ID = 1
            };
            var node2 = new SuffixIndexNode {
                Term = "AnotherTerm", ID = 2
            };
            var indexer = new SQLiteSuffixIndexer(Path.GetTempFileName());

            indexer.InitializeDB();

            indexer.AddToIndex(node1, node2);

            Assert.AreEqual(2, indexer.Retrieve("Term").Count());
        }
Exemplo n.º 3
0
        public void RetrieveIsCaseInsentive()
        {
            var node1 = new SuffixIndexNode {
                Term = "SomeTerm", ID = 1
            };
            var node2 = new SuffixIndexNode {
                Term = "AnotherTerm", ID = 2
            };
            var indexer = new SQLiteSuffixIndexer(Path.GetTempFileName());

            indexer.InitializeDB();

            indexer.AddToIndex(node1);
            indexer.AddToIndex(node2);

            Assert.AreEqual(2, indexer.Retrieve("ter").Count());
        }
Exemplo n.º 4
0
        public void CanRetreiveEachByEachSuffix()
        {
            var node = new SuffixIndexNode {
                Term = "SomeTerm", ID = 1
            };
            var indexer = new SQLiteSuffixIndexer(Path.GetTempFileName());

            indexer.InitializeDB();

            indexer.AddToIndex(node);

            Assert.AreEqual(1, indexer.Retrieve("SomeTerm").Count());
            Assert.AreEqual(1, indexer.Retrieve("omeTerm").Count());
            Assert.AreEqual(1, indexer.Retrieve("meTerm").Count());
            Assert.AreEqual(1, indexer.Retrieve("eTerm").Count());
            Assert.AreEqual(1, indexer.Retrieve("Term").Count());
            Assert.AreEqual(1, indexer.Retrieve("erm").Count());
            Assert.AreEqual(1, indexer.Retrieve("rm").Count());
            Assert.AreEqual(1, indexer.Retrieve("m").Count());
        }