public void should_query_with_special_string() { LuceneSearchProvider lueceneSearchProvider = new LuceneSearchProvider(); var spaceOne = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "技术空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; lueceneSearchProvider.Add(spaceOne); var results = lueceneSearchProvider.Query<SpaceObject>("*****"); Assert.AreEqual(results.Count, 0); results = lueceneSearchProvider.Query<SpaceObject>("#@RF**__++||"); Assert.AreEqual(results.Count, 0); results = lueceneSearchProvider.Query<SpaceObject>(" || __ "); Assert.AreEqual(results.Count, 0); }
public void should_query_with_special_string() { LuceneSearchProvider lueceneSearchProvider = new LuceneSearchProvider(); var spaceOne = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "技术空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; lueceneSearchProvider.Add(spaceOne); var results = lueceneSearchProvider.Query <SpaceObject>("*****"); Assert.AreEqual(results.Count, 0); results = lueceneSearchProvider.Query <SpaceObject>("#@RF**__++||"); Assert.AreEqual(results.Count, 0); results = lueceneSearchProvider.Query <SpaceObject>(" || __ "); Assert.AreEqual(results.Count, 0); }
public void test_with_write_and_delete_document() { var lueceneSearchProvider = new LuceneSearchProvider(); var spaceOne = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "技术空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; Stopwatch stopWatcher = new Stopwatch(); stopWatcher.Start(); lueceneSearchProvider.IndexDirectory = "write_delete_space"; lueceneSearchProvider.Add(spaceOne); var results = lueceneSearchProvider.Query <SpaceObject>("空间"); Assert.IsTrue(results.Count >= 1); lueceneSearchProvider.Delete(spaceOne); results = lueceneSearchProvider.Query <SpaceObject>("空间"); Assert.AreEqual(results.Count, 0); Console.WriteLine(results.Count); }
public void test_with_write_index_singleton() { LuceneSearchProvider lueceneSearchProvider = new LuceneSearchProvider(); var spaceOne = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "技术空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; var spaceTwo = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "生存空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; Stopwatch stopWatcher = new Stopwatch(); stopWatcher.Start(); lueceneSearchProvider.IndexDirectory = "tempspace"; lueceneSearchProvider.Add(spaceOne); lueceneSearchProvider.Add(spaceTwo); var results = lueceneSearchProvider.Query <SpaceObject>("空间"); Assert.IsTrue(results.Count >= 2); Console.WriteLine(results.Count); }
public void test_with_write_and_delete_document() { var lueceneSearchProvider = new LuceneSearchProvider(); var spaceOne = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "技术空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; Stopwatch stopWatcher = new Stopwatch(); stopWatcher.Start(); lueceneSearchProvider.IndexDirectory = "write_delete_space"; lueceneSearchProvider.Add(spaceOne); var results = lueceneSearchProvider.Query<SpaceObject>("空间"); Assert.IsTrue(results.Count>= 1); lueceneSearchProvider.Delete(spaceOne); results = lueceneSearchProvider.Query<SpaceObject>("空间"); Assert.AreEqual(results.Count, 0); Console.WriteLine(results.Count); }
public void test_with_write_index_singleton() { LuceneSearchProvider lueceneSearchProvider = new LuceneSearchProvider(); var spaceOne = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "技术空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; var spaceTwo = new SpaceObject { Id = Guid.NewGuid(), SpaceName = "生存空间", FileCount = 1, ParentId = Guid.NewGuid().ToString(), SpaceSize = 1024, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, CreateUserId = "5", CreateUserName = "******", }; Stopwatch stopWatcher = new Stopwatch(); stopWatcher.Start(); lueceneSearchProvider.IndexDirectory = "tempspace"; lueceneSearchProvider.Add(spaceOne); lueceneSearchProvider.Add(spaceTwo); var results = lueceneSearchProvider.Query<SpaceObject>("空间"); Assert.IsTrue(results.Count>= 2); Console.WriteLine(results.Count); }