Ejemplo n.º 1
0
        static string GetAbstract(ObjectId docId)
        {
            MongodbAccess mongo = new MongodbAccess();
            WebPage       page  = mongo.GetWebPageById(docId);

            return(page.title.Length < page.content.Length ?
                   page.content.Substring(page.title.Length, (page.content.Length - page.title.Length) > 150 ? 150 : (page.content.Length - page.title.Length)) : "");
        }
Ejemplo n.º 2
0
        static List <DocUrlAbstractResult> GetResult(List <ObjectId> docIds)
        {
            List <DocUrlAbstractResult> ret = new List <DocUrlAbstractResult>();
            MongodbAccess mongo             = new MongodbAccess();

            foreach (ObjectId docId in docIds)
            {
                WebPage page = mongo.GetWebPageById(docId);
                DocUrlAbstractResult duar = new DocUrlAbstractResult();
                duar.title = page.title;
                duar.url   = page.url;
                duar.abst  = GetAbstract(docId);
                ret.Add(duar);
            }
            return(ret);
        }