示例#1
0
        static void Main(string[] args)
        {
            string dataFolder = @"C:\Temp\LuceneWrapper";

            LoadPeople();
            var writer = new PersonWriter(dataFolder);
            writer.AddUpdatePeopleToIndex(people);

            var searcher = new PersonSearcher(dataFolder);

            Console.WriteLine("Search on first name Bart in FirstName field");
            var res = searcher.SearchPeople("Bart", "FirstName");
            PrintResult(res);

            Console.WriteLine("Search on 2014 in LastName field");
            res = searcher.SearchPeople("2014", "LastName");
            PrintResult(res);

            Console.WriteLine("Search on 2014 in RegistrationString field");
            res = searcher.SearchPeople("2014", "RegistrationString");
            PrintResult(res);

            Console.WriteLine("Search on nl in all fields");
            res = searcher.SearchPeople("nl", string.Empty);
            PrintResult(res);

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            string dataFolder = @"C:\Temp\LuceneWrapper";

            LoadPeople();
            var writer = new PersonWriter(dataFolder);

            writer.AddUpdatePeopleToIndex(people);

            var searcher = new PersonSearcher(dataFolder);

            Console.WriteLine("Search on first name Bart in FirstName field");
            var res = searcher.SearchPeople("Bart", "FirstName");

            PrintResult(res);

            Console.WriteLine("Search on 2014 in LastName field");
            res = searcher.SearchPeople("2014", "LastName");
            PrintResult(res);

            Console.WriteLine("Search on 2014 in RegistrationString field");
            res = searcher.SearchPeople("2014", "RegistrationString");
            PrintResult(res);

            Console.WriteLine("Search on nl in all fields");
            res = searcher.SearchPeople("nl", string.Empty);
            PrintResult(res);


            Console.ReadKey();
        }