コード例 #1
0
        /// <summary>
        /// Call this function if you want to create a new default index and a few books to the index
        /// </summary>
        static void CreateIndexAndAddSomeBooks()
        {
            Console.WriteLine("Let's create an index called: library ");

            // Use this method to create a new index called "library"
            if (repo.CreateLibraryIndex())
            {
                Console.WriteLine("Index has been created.");
            }

            Console.WriteLine("Let's index a few books ... ");

            var bk1 = new Book()
            {
                Id          = 1,
                ContentId   = "ISBN 978-0-307-27812-8",
                Author      = "Brian Greene",
                Title       = "The Hidden Reality",
                Genre       = "Popular Science",
                PublishDate = new DateTime(2011, 1, 1)
            };


            var bk2 = new Book()
            {
                Id          = 2,
                ContentId   = "ISBN-13: 9781451675047",
                Author      = "Richard Dawkins, Dave McKean",
                Title       = "The Magic of Reality: How We Know What's Really True",
                Genre       = "Science - General & Miscellaneous",
                PublishDate = new DateTime(2012, 9, 11)
            };

            var bk3 = new Book()
            {
                Id          = 3,
                ContentId   = "ISBN-13: 9780062225795",
                Author      = "Richard Dawkins",
                Title       = "An Appetite for Wonder: The Making of a Scientist",
                Genre       = "Biography",
                PublishDate = new DateTime(2013, 9, 24)
            };

            repo.AddBook(bk1);
            repo.AddBook(bk2);
            repo.AddBook(bk3);
        }