public Task <List <Guid> > SearchAsync(string queryText, SearchContext context) { var result = new List <Guid>(); if (!string.IsNullOrWhiteSpace(queryText)) { var query = BuildQuery(queryText, context); if (indexReader == null && indexWriter.NumDocs > 0) { OpenReader(); } if (indexReader != null) { var found = new HashSet <Guid>(); var hits = indexSearcher.Search(query, MaxResults).ScoreDocs; foreach (var hit in hits) { if (TextIndexContent.TryGetId(hit.Doc, context.Scope, indexReader, indexState, out var id)) { if (found.Add(id)) { result.Add(id); } } } } } return(Task.FromResult(result.ToList())); }
public Task <bool> CopyAsync(Guid id, bool fromDraft) { var content = new TextIndexContent(indexWriter, indexState, id); content.Copy(fromDraft); return(TryFlushAsync()); }
private Task <bool> IndexInternalAsync(Update update) { var content = new TextIndexContent(indexWriter, indexState, update.Id); content.Index(update.Data, update.OnlyDraft); return(TryFlushAsync()); }
public Task <bool> DeleteAsync(Guid id) { var content = new TextIndexContent(indexWriter, indexState, id); content.Delete(); return(TryFlushAsync()); }
public Task IndexAsync(Guid id, J <IndexData> data, bool onlyDraft) { var content = new TextIndexContent(indexWriter, indexSearcher, indexState, id); content.Index(data.Value.Data, onlyDraft); return(TryFlushAsync()); }
public Task <bool> DeleteAsync(Guid id) { var content = new TextIndexContent(index, indexState, id); content.Delete(); return(TryCommitAsync()); }
public Task <bool> IndexAsync(Update update) { var content = new TextIndexContent(index, indexState, update.Id); content.Index(update.Text, update.OnlyDraft); return(TryCommitAsync()); }