Added defensive logic to File Indexer for scenarios where file does not exist on disk. Added ability to reset the search index prior to reindexing.
This commit is contained in:
@ -12,7 +12,7 @@ namespace Oqtane.Repository
|
||||
void DeleteSearchContent(int searchContentId);
|
||||
void DeleteSearchContent(string entityName, string entryId);
|
||||
void DeleteSearchContent(string uniqueKey);
|
||||
void DeleteAllSearchContent();
|
||||
void DeleteAllSearchContent(int siteId);
|
||||
|
||||
SearchWord GetSearchWord(string word);
|
||||
SearchWord AddSearchWord(SearchWord searchWord);
|
||||
|
@ -152,11 +152,17 @@ namespace Oqtane.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAllSearchContent()
|
||||
public void DeleteAllSearchContent(int siteId)
|
||||
{
|
||||
using var db = _dbContextFactory.CreateDbContext();
|
||||
db.SearchContent.RemoveRange(db.SearchContent);
|
||||
db.SaveChanges();
|
||||
// delete in batches of 100 records
|
||||
var searchContents = db.SearchContent.Where(item => item.SiteId == siteId).Take(100).ToList();
|
||||
while (searchContents.Count > 0)
|
||||
{
|
||||
db.SearchContent.RemoveRange(searchContents);
|
||||
db.SaveChanges();
|
||||
searchContents = db.SearchContent.Where(item => item.SiteId == siteId).Take(100).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public SearchWord GetSearchWord(string word)
|
||||
|
Reference in New Issue
Block a user