懒得勤快 vor 6 Jahren
Ursprung
Commit
9206f7a86c

+ 2 - 1
Masuit.LuceneEFCore.SearchEngine.Test/LuceneIndexSearcherTests.cs

@@ -4,6 +4,7 @@ using Lucene.Net.Documents;
 using Lucene.Net.Store;
 using Masuit.LuceneEFCore.SearchEngine.Test.Helpers;
 using Masuit.LuceneEFCore.SearchEngine.Test.Models;
+using Microsoft.Extensions.Caching.Memory;
 using System.Linq;
 using Xunit;
 
@@ -17,7 +18,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
 
         // create an index
         static readonly LuceneIndexer Indexer = new LuceneIndexer(Directory, Analyzer);
-        static readonly LuceneIndexSearcher Searcher = new LuceneIndexSearcher(Directory, Analyzer);
+        static readonly LuceneIndexSearcher Searcher = new LuceneIndexSearcher(Directory, Analyzer, new MemoryCache(new MemoryCacheOptions()));
 
         public LuceneIndexSearcherTests(TestDataGenerator tdg)
         {

+ 2 - 1
Masuit.LuceneEFCore.SearchEngine.Test/LuceneIndexerTests.cs

@@ -4,6 +4,7 @@ using Lucene.Net.Documents;
 using Lucene.Net.Store;
 using Masuit.LuceneEFCore.SearchEngine.Test.Helpers;
 using Masuit.LuceneEFCore.SearchEngine.Test.Models;
+using Microsoft.Extensions.Caching.Memory;
 using System;
 using System.Linq;
 using Xunit;
@@ -98,7 +99,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             _indexer.CreateIndex(tdg.AllData);
 
             // we need a searcher for this test
-            LuceneIndexSearcher searcher = new LuceneIndexSearcher(directory, analyzer);
+            LuceneIndexSearcher searcher = new LuceneIndexSearcher(directory, analyzer, new MemoryCache(new MemoryCacheOptions()));
 
             // get the 1st item
             SearchOptions options = new SearchOptions("[email protected]", "Email");

+ 0 - 9
Masuit.LuceneEFCore.SearchEngine.Test/LuceneSearchOptionsTests.cs

@@ -5,15 +5,6 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
 {
     public class LuceneSearchOptionsTests
     {
-        [Fact]
-        public void DefaultLuceneSearchOptionsInitialisesCollections()
-        {
-            SearchOptions options = new SearchOptions();
-
-            Assert.NotNull(options.OrderBy);
-            Assert.NotNull(options.Fields);
-        }
-
         [Fact]
         public void LuceneSearchOptionsCanBeConstructedWithMultipleFields()
         {

+ 11 - 10
Masuit.LuceneEFCore.SearchEngine.Test/SearchEngineTests.cs

@@ -2,6 +2,7 @@
 using Masuit.LuceneEFCore.SearchEngine.Test.Helpers;
 using Masuit.LuceneEFCore.SearchEngine.Test.Models;
 using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Caching.Memory;
 using System.Linq;
 using Xunit;
 using Xunit.Abstractions;
@@ -35,7 +36,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -55,7 +56,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -78,7 +79,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -111,7 +112,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -136,7 +137,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -159,7 +160,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -186,7 +187,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -210,7 +211,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             User jc = new User()
             {
@@ -245,7 +246,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 
@@ -280,7 +281,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Test
             {
                 UseRamDirectory = true
             };
-            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context);
+            SearchEngine<TestDbContext> searchProvider = new SearchEngine<TestDbContext>(options, _context, new MemoryCache(new MemoryCacheOptions()));
 
             searchProvider.CreateIndex();
 

+ 6 - 0
Masuit.LuceneEFCore.SearchEngine.sln

@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.LuceneEFCore.SearchE
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.LuceneEFCore.SearchEngine.Test", "Masuit.LuceneEFCore.SearchEngine.Test\Masuit.LuceneEFCore.SearchEngine.Test.csproj", "{0E1A15E2-174C-4FE3-A4CC-A77B9BC326E8}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebSearchDemo", "WebSearchDemo\WebSearchDemo.csproj", "{12EF81D1-26CF-417C-A814-BB49A0F87AFE}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
 		{0E1A15E2-174C-4FE3-A4CC-A77B9BC326E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{0E1A15E2-174C-4FE3-A4CC-A77B9BC326E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{0E1A15E2-174C-4FE3-A4CC-A77B9BC326E8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{12EF81D1-26CF-417C-A814-BB49A0F87AFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{12EF81D1-26CF-417C-A814-BB49A0F87AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{12EF81D1-26CF-417C-A814-BB49A0F87AFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{12EF81D1-26CF-417C-A814-BB49A0F87AFE}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 1 - 1
Masuit.LuceneEFCore.SearchEngine/Interfaces/ILuceneIndexable.cs

@@ -10,7 +10,7 @@ namespace Masuit.LuceneEFCore.SearchEngine.Interfaces
         /// <summary>
         /// 主键id
         /// </summary>
-        long Id { get; set; }
+        int Id { get; set; }
 
         /// <summary>
         /// 索引id

+ 3 - 6
Masuit.LuceneEFCore.SearchEngine/LuceneIndexSearcher.cs

@@ -71,10 +71,7 @@ namespace Masuit.LuceneEFCore.SearchEngine
                     var res = HttpClient.GetAsync($"/api/customsearch/keywords?title={keyword}").Result;
                     if (res.StatusCode == HttpStatusCode.OK)
                     {
-                        BaiduAnalysisModel model = JsonConvert.DeserializeObject<BaiduAnalysisModel>(res.Content.ReadAsStringAsync().Result, new JsonSerializerSettings()
-                        {
-                            NullValueHandling = NullValueHandling.Ignore
-                        });
+                        BaiduAnalysisModel model = JsonConvert.DeserializeObject<BaiduAnalysisModel>(res.Content.ReadAsStringAsync().Result);
                         model.Result.Res.KeywordList?.ForEach(s => set.Add(s));
                     }
                 }
@@ -85,7 +82,7 @@ namespace Masuit.LuceneEFCore.SearchEngine
             }
             set.RemoveWhere(s => s.Length < 2 || Regex.IsMatch(s, @"^\p{P}.*"));
             list = set.OrderByDescending(s => s.Length).ToList();
-            _memoryCache.Set(keyword, list);
+            _memoryCache.Set(keyword, list, TimeSpan.FromHours(1));
             return list;
         }
 
@@ -101,7 +98,7 @@ namespace Masuit.LuceneEFCore.SearchEngine
             var terms = CutKeywords(keywords);
             foreach (var term in terms)
             {
-                finalQuery.Add(parser.Parse(term.Replace("~", "") + "~"), Occur.MUST);
+                finalQuery.Add(parser.Parse(term.Replace("~", "") + "~"), Occur.SHOULD);
             }
             return finalQuery;
         }

+ 1 - 1
Masuit.LuceneEFCore.SearchEngine/LuceneIndexableBaseEntity.cs

@@ -17,7 +17,7 @@ namespace Masuit.LuceneEFCore.SearchEngine
         /// 主键id
         /// </summary>
         [LuceneIndexable(Name = "Id", Store = Field.Store.YES, Index = Field.Index.NOT_ANALYZED), Key]
-        public long Id { get; set; }
+        public int Id { get; set; }
 
         /// <summary>
         /// 索引唯一id

+ 48 - 12
Masuit.LuceneEFCore.SearchEngine/SearchOptions.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 
 namespace Masuit.LuceneEFCore.SearchEngine
 {
@@ -97,18 +98,7 @@ namespace Masuit.LuceneEFCore.SearchEngine
         }
 
         /// <summary>
-        /// 构造函数
-        /// </summary>
-        public SearchOptions()
-        {
-            Fields = new List<string>();
-            OrderBy = new List<string>();
-            MaximumNumberOfHits = 10000;
-            boosts = new Dictionary<string, float>();
-        }
-
-        /// <summary>
-        /// 构造函数
+        /// 搜索选项
         /// </summary>
         /// <param name="keywords">关键词</param>
         /// <param name="fields">限定检索字段</param>
@@ -120,6 +110,10 @@ namespace Masuit.LuceneEFCore.SearchEngine
         /// <param name="take">取多少条</param>
         public SearchOptions(string keywords, string fields, int maximumNumberOfHits = 10000, Dictionary<string, float> boosts = null, Type type = null, string orderBy = null, int? skip = null, int? take = null)
         {
+            if (string.IsNullOrWhiteSpace(keywords))
+            {
+                throw new ArgumentException("搜索关键词不能为空!");
+            }
             Keywords = keywords;
             MaximumNumberOfHits = maximumNumberOfHits;
             Skip = skip;
@@ -145,5 +139,47 @@ namespace Masuit.LuceneEFCore.SearchEngine
                 OrderBy.AddRange(orderBy.Split(',').ToList());
             }
         }
+
+        /// <summary>
+        /// 搜索选项
+        /// </summary>
+        /// <param name="keywords">关键词</param>
+        /// <param name="size">页大小</param>
+        /// <param name="fields">限定检索字段</param>
+        /// <param name="page">第几页</param>
+        public SearchOptions(string keywords, int page, int size, string fields) : this(keywords, fields, int.MaxValue, null, null, null, (page - 1) * size, size)
+        {
+            if (page < 1)
+            {
+                page = 1;
+            }
+            if (size < 1)
+            {
+                size = 1;
+            }
+            Skip = (page - 1) * size;
+            Take = size;
+        }
+
+        /// <summary>
+        /// 搜索选项
+        /// </summary>
+        /// <param name="keywords">关键词</param>
+        /// <param name="size">页大小</param>
+        /// <param name="page">第几页</param>
+        /// <param name="t">需要被全文检索的类型</param>
+        public SearchOptions(string keywords, int page, int size, Type t) : this(keywords, string.Join(",", t.GetProperties().Where(p => p.GetCustomAttributes<LuceneIndexableAttribute>().Any()).Select(p => p.Name)), int.MaxValue, null, null, null, (page - 1) * size, size)
+        {
+            if (page < 1)
+            {
+                page = 1;
+            }
+            if (size < 1)
+            {
+                size = 1;
+            }
+            Skip = (page - 1) * size;
+            Take = size;
+        }
     }
 }

+ 27 - 0
WebSearchDemo/Controllers/HomeController.cs

@@ -0,0 +1,27 @@
+using Masuit.LuceneEFCore.SearchEngine;
+using Masuit.LuceneEFCore.SearchEngine.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using System.Threading.Tasks;
+using WebSearchDemo.Database;
+
+namespace WebSearchDemo.Controllers
+{
+    [Route("[controller]/[action]")]
+    public class HomeController : Controller
+    {
+        private readonly ISearchEngine<DataContext> _searchEngine;
+
+        public HomeController(ISearchEngine<DataContext> searchEngine)
+        {
+            _searchEngine = searchEngine;
+        }
+
+        [HttpGet]
+        public async Task<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)));
+            return Ok(result);
+        }
+    }
+}

+ 21 - 0
WebSearchDemo/Database/DataContext.cs

@@ -0,0 +1,21 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace WebSearchDemo.Database
+{
+    public class DataContext : DbContext
+    {
+        public DataContext(DbContextOptions<DataContext> options) : base(options)
+        {
+
+        }
+
+        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+        {
+            base.OnConfiguring(optionsBuilder);
+            optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.TrackAll);
+        }
+
+        public virtual DbSet<Post> Post { get; set; }
+
+    }
+}

+ 61 - 0
WebSearchDemo/Database/Post.cs

@@ -0,0 +1,61 @@
+using Masuit.LuceneEFCore.SearchEngine;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace WebSearchDemo.Database
+{
+    /// <summary>
+    /// 文章
+    /// </summary>
+    [Table("Post")]
+    public class Post : LuceneIndexableBaseEntity
+    {
+        public Post()
+        {
+            PostDate = DateTime.Now;
+        }
+
+        /// <summary>
+        /// 标题
+        /// </summary>
+        [Required(ErrorMessage = "文章标题不能为空!"), LuceneIndexable]
+        public string Title { get; set; }
+
+        /// <summary>
+        /// 作者
+        /// </summary>
+        [Required, MaxLength(24, ErrorMessage = "作者名最长支持24个字符!"), LuceneIndexable]
+        public string Author { get; set; }
+
+        /// <summary>
+        /// 内容
+        /// </summary>
+        [Required(ErrorMessage = "文章内容不能为空!"), LuceneIndexable(IsHtml = true)]
+        public string Content { get; set; }
+
+        /// <summary>
+        /// 发表时间
+        /// </summary>
+        public DateTime PostDate { get; set; }
+
+        /// <summary>
+        /// 作者邮箱
+        /// </summary>
+        [Required(ErrorMessage = "作者邮箱不能为空!"), LuceneIndexable]
+        public string Email { get; set; }
+
+        /// <summary>
+        /// 标签
+        /// </summary>
+        [StringLength(256, ErrorMessage = "标签最大允许255个字符"), LuceneIndexable]
+        public string Label { get; set; }
+
+        /// <summary>
+        /// 文章关键词
+        /// </summary>
+        [StringLength(256, ErrorMessage = "文章关键词最大允许255个字符"), LuceneIndexable]
+        public string Keyword { get; set; }
+
+    }
+}

+ 24 - 0
WebSearchDemo/Program.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+
+namespace WebSearchDemo
+{
+    public class Program
+    {
+        public static void Main(string[] args)
+        {
+            CreateWebHostBuilder(args).Build().Run();
+        }
+
+        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
+            WebHost.CreateDefaultBuilder(args)
+                .UseStartup<Startup>();
+    }
+}

+ 29 - 0
WebSearchDemo/Properties/launchSettings.json

@@ -0,0 +1,29 @@
+{
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:7993",
+      "sslPort": 0
+    }
+  },
+  "$schema": "http://json.schemastore.org/launchsettings.json",
+  "profiles": {
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "launchUrl": "api/values",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    },
+    "WebSearchDemo": {
+      "commandName": "Project",
+      "launchUrl": "api/values",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      },
+      "applicationUrl": "http://localhost:5000"
+    }
+  }
+}

+ 83 - 0
WebSearchDemo/Startup.cs

@@ -0,0 +1,83 @@
+using JiebaNet.Segmenter;
+using Lucene.Net.Analysis.JieBa;
+using Lucene.Net.Store;
+using Masuit.LuceneEFCore.SearchEngine;
+using Masuit.LuceneEFCore.SearchEngine.Interfaces;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Swashbuckle.AspNetCore.Swagger;
+using System;
+using WebSearchDemo.Database;
+
+namespace WebSearchDemo
+{
+    public class Startup
+    {
+        public Startup(IConfiguration configuration)
+        {
+            Configuration = configuration;
+        }
+
+        public IConfiguration Configuration { get; }
+
+        // This method gets called by the runtime. Use this method to add services to the container.
+        public void ConfigureServices(IServiceCollection services)
+        {
+            services.AddDbContext<DataContext>(db =>
+            {
+                //db.UseInMemoryDatabase();
+                db.UseSqlServer("Data Source=.;Initial Catalog=MyBlogs;Integrated Security=True");
+            });
+            AddSearchEngine(services, new LuceneIndexerOptions()
+            {
+                Path = "lucene",
+                UseRamDirectory = false,
+                MaximumFieldLength = 10000
+            });
+            services.AddSwaggerGen(c =>
+            {
+                c.SwaggerDoc("v1", new Info
+                {
+                    Title = "API文档",
+                    Version = "v1"
+                });
+                c.DescribeAllEnumsAsStrings();
+                c.IncludeXmlComments(AppContext.BaseDirectory + "WebSearchDemo.xml");
+            }); //配置swagger
+            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
+        }
+
+        public static void AddSearchEngine(IServiceCollection services, LuceneIndexerOptions option)
+        {
+            services.AddSingleton(s => option);
+            services.AddMemoryCache();
+            services.AddTransient<Directory>(s => FSDirectory.Open(option.Path));
+            services.AddTransient(s => new JieBaAnalyzer(TokenizerMode.Search));
+            services.AddTransient<ILuceneIndexer, LuceneIndexer>();
+            services.AddTransient<ILuceneIndexSearcher, LuceneIndexSearcher>();
+            services.AddTransient<ISearchEngine<DataContext>, SearchEngine<DataContext>>();
+        }
+
+        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DataContext db, ISearchEngine<DataContext> searchEngine)
+        {
+            if (env.IsDevelopment())
+            {
+                app.UseDeveloperExceptionPage();
+            }
+            //searchEngine.CreateIndex(new List<string>()
+            //{
+            //    nameof(Post)
+            //});
+            app.UseSwagger().UseSwaggerUI(c =>
+            {
+                c.SwaggerEndpoint($"/swagger/v1/swagger.json", "懒得勤快的博客");
+            }); //配置swagger
+            app.UseMvcWithDefaultRoute();
+        }
+    }
+}

+ 23 - 0
WebSearchDemo/WebSearchDemo.csproj

@@ -0,0 +1,23 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+    <DocumentationFile>D:\Private\Masuit.LuceneEFCore.SearchEngine\WebSearchDemo\WebSearchDemo.xml</DocumentationFile>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.AspNetCore.App" />
+    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.1" />
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Masuit.LuceneEFCore.SearchEngine\Masuit.LuceneEFCore.SearchEngine.csproj" />
+  </ItemGroup>
+
+</Project>

+ 48 - 0
WebSearchDemo/WebSearchDemo.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>WebSearchDemo</name>
+    </assembly>
+    <members>
+        <member name="T:WebSearchDemo.Database.Post">
+            <summary>
+            文章
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.Title">
+            <summary>
+            标题
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.Author">
+            <summary>
+            作者
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.Content">
+            <summary>
+            内容
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.PostDate">
+            <summary>
+            发表时间
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.Email">
+            <summary>
+            作者邮箱
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.Label">
+            <summary>
+            标签
+            </summary>
+        </member>
+        <member name="P:WebSearchDemo.Database.Post.Keyword">
+            <summary>
+            文章关键词
+            </summary>
+        </member>
+    </members>
+</doc>

+ 9 - 0
WebSearchDemo/appsettings.Development.json

@@ -0,0 +1,9 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Debug",
+      "System": "Information",
+      "Microsoft": "Information"
+    }
+  }
+}

+ 8 - 0
WebSearchDemo/appsettings.json

@@ -0,0 +1,8 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Warning"
+    }
+  },
+  "AllowedHosts": "*"
+}