Example #1
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());
        }
Example #2
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());
        }
Example #3
0
        public void ReturnsAllSubstringMatchingResults()
        {
            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());
        }
Example #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());
        }