private List <Instruction> SearchInstructionLucene(ApplicationDbContext db, string query) { List <int> listInt = LuceneSearchConfig.Search(query); var instr = db.Instructions.Where(r => listInt.Contains(r.Id)); return(instr.ToList()); }
public void Configuration(IAppBuilder app) { ConfigureAuth(app); app.MapSignalR(); LuceneSearchConfig.InitializeSearch(); /*Step s1 = new Step { Id = 1, Name = "шаг 1" }; * s1.Blocks.Add(new Block { Name="блок 1",Type="Text"}); * s1.Blocks.Add(new Block { Name = "блок 2", Type = "Text" }); * Step s2 = new Step { Id = 2, Name = "шаг 2" }; * s2.Blocks.Add(new Block { Name = "блок 3", Type = "Text" }); * s2.Blocks.Add(new Block { Name = "блок 4", Type = "Text" }); * Instruction instr = new Instruction { Id = 10, Name = "текст 43" }; * instr.Steps.Add(s1); * instr.Steps.Add(s2); * LuceneSearchConfig.CreateIndex(instr); * LuceneSearchConfig.DeleteDocument(10); * List<int> list=LuceneSearchConfig.Search("блок");*/ //AddCategory(); //CreateRolesandUsers(); }
private void SaveInstructionLucene(ApplicationDbContext db, Instruction instruction) { var instr = db.Instructions.Find(instruction.Id); LuceneSearchConfig.CreateIndex(instr); }