private static SearchV2Response.Types.SearchCard GenericMessageCard(string message) { return(new SearchV2Response.Types.SearchCard { GenericMessage = new SearchV2Response.Types.SearchCard.Types .GenericMessageCard() { Message = RichTextUtil.FromString(message) } }); }
private IEnumerable <SearchV2Response.Types.SearchCard> RenderDocs(IEnumerable <ScoreDoc> scoreDocs, ZhConverter zhConverter) { var searcher = this._indexHolder.LuceneIndexSearcher; return(scoreDocs.Select(sd => { var docId = searcher.Doc(sd.Doc).GetField(LuceneUtils.Fields.DocId).GetStringValue(); var ydDoc = _indexHolder.GetIndex().YngdiengDocuments.Single(y => y.DocId == docId); return new SearchV2Response.Types.SearchCard { Word = new SearchV2Response.Types.SearchCard.Types.WordCard { Id = docId, Yngping = RichTextUtil.FromString(ydDoc.YngpingSandhi.OrElse(ydDoc.YngpingUnderlying)), Hanzi = RichTextUtil.FromString(zhConverter.tH(HanziUtils.HanziToString(ydDoc.HanziCanonical))), Details = RichTextUtil.FromString(zhConverter.tM(Yngdieng.Backend.Services.Frontend.Words.GetSnippet (ydDoc, new Extension[] { }))), Score = sd.Score } }; })); }