懒得勤快 6 anni fa
parent
commit
3da85d2d42
2 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 1 2
      WebSearchDemo/Controllers/HomeController.cs
  2. 1 1
      WebSearchDemo/Startup.cs

+ 1 - 2
WebSearchDemo/Controllers/HomeController.cs

@@ -2,7 +2,6 @@
 using Masuit.LuceneEFCore.SearchEngine.Interfaces;
 using Microsoft.AspNetCore.Mvc;
 using System.Collections.Generic;
-using System.Threading.Tasks;
 using WebSearchDemo.Database;
 
 namespace WebSearchDemo.Controllers
@@ -25,7 +24,7 @@ namespace WebSearchDemo.Controllers
         /// <param name="size">页大小</param>
         /// <returns></returns>
         [HttpGet]
-        public async Task<IActionResult> Index(string s, int page, int size)
+        public IActionResult Index(string s, int page, int size)
         {
             //var result = _searchEngine.ScoredSearch<Post>(new SearchOptions(s, page, size, "Title,Content,Email,Author"));
             var result = _searchEngine.ScoredSearch<Post>(new SearchOptions(s, page, size, typeof(Post)));

+ 1 - 1
WebSearchDemo/Startup.cs

@@ -30,7 +30,7 @@ namespace WebSearchDemo
         {
             services.AddDbContext<DataContext>(db =>
             {
-                db.UseInMemoryDatabase();
+                db.UseInMemoryDatabase("test");
                 //db.UseSqlServer("Data Source=.;Initial Catalog=MyBlogs;Integrated Security=True");
             });
             services.AddSearchEngine<DataContext>(new LuceneIndexerOptions()