예제 #1
0
        public async Task<IHttpActionResult> Rebuild()
        {
            var pages = await db.Pages.Where(w => w.Deleted != true && w.Active == true)
                .Select(s => new IndexStore()
                {
                    Content = s.Content,
                    ID = s.Id,
                    SearchTerms = "",
                    Title = s.Title,
                    Type = "page",
                    UrlKey = s.UrlKey
                }).ToListAsync();

            var sections = await db.Sections.Where(w => w.Deleted != true && w.Active == true)
                .Select(s => new IndexStore()
                {
                    Content = s.Contents,
                    ID = s.Id,
                    SearchTerms = s.SearchTerms,
                    Title = s.Title,
                    Type = "section",
                    UrlKey = s.URLKey
                }).ToListAsync();

            sections.AddRange(pages);

            LuceneHelper indexHelper = new LuceneHelper();
            indexHelper.PopulateIndex(sections);

            return Ok();
        }
예제 #2
0
 public IHttpActionResult Search(string terms)
 {
     LuceneHelper indexHelper = new LuceneHelper();
     var search = indexHelper.Search(terms);
     return Ok(search);
 }