惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
S
Security Affairs
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
Microsoft Security Blog
Microsoft Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
C
Cisco Blogs
T
Tor Project blog
The Hacker News
The Hacker News
雷峰网
雷峰网
MyScale Blog
MyScale Blog
博客园 - 司徒正美
AWS News Blog
AWS News Blog
GbyAI
GbyAI
Y
Y Combinator Blog
D
DataBreaches.Net
Simon Willison's Weblog
Simon Willison's Weblog
S
Securelist
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
T
Tenable Blog
L
LangChain Blog
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
The Cloudflare Blog
A
About on SuperTechFans
IT之家
IT之家
F
Fortinet All Blogs
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
NISL@THU
NISL@THU
爱范儿
爱范儿
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
W
WeLiveSecurity
A
Arctic Wolf
I
Intezer
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - yuejianjun

搜索结果点击情况 进行加权 java httpURL连接远程服务器并返回数据(httpurlconnection)(转) 实体类 topN topN 堆排序 (int 类型) 过滤词 Lucene的评分(score) 位图求交集 位运算包含功能 页面抓取匹配时,万恶的 , , 要先替换掉为空,出现匹配有问题,都是这个引起的 探索推荐引擎内部的秘密,第 1 部分: 推荐引擎初探 深度用户行为 多维度深入分析笔记 lucene 搜索学习笔记 - OK 中文自动摘要提取 常用的vs编码 快捷键 Lucene中的堆(Heap)[ScorerDocQueue,TopScoreDocCollector] lucene 大数据量 快速 排序 l u c e n e 创 建 修 改 删 除 索 引 集中、分布式搜索引擎的4种设计方案 lucene fenlei ThreadPool 使用
T a s k 搜 索 ( L u c e n e )
yuejianjun · 2011-11-04 · via 博客园 - yuejianjun

2011-11-04 17:33  yuejianjun  阅读(213)  评论()    收藏  举报

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using Comm;
using Entity;

namespace Service
{
   public class SearchTask
    {
        public static ReturnItem TaskSearchModuleSecond(QueryItemEntity queryItemEntity)
        {
            string[] indexPath = Profile.IndexModuleSecondPath();
            Task<ReturnItem> parentTask = new Task<ReturnItem>(() =>
            {
                IList<Task<ReturnItem>> taskArray = new List<Task<ReturnItem>>();

                for (int i = 0; i < indexPath.Length; i++)
                {
                    string path = indexPath[i];

                    Task<ReturnItem> childTask = new Task<ReturnItem>
                         (() =>
                         {
                             ReturnItem result = SearchService(queryItemEntity, path);
                             return result;
                         }, TaskCreationOptions.AttachedToParent);
                    taskArray.Add(childTask);
                }

                foreach (Task<ReturnItem> t in taskArray)
                    t.Start();

                ReturnItem listResult = new ReturnItem();

                foreach (Task<ReturnItem> t in taskArray)
                {
                    listResult.TotalHits += t.Result.TotalHits;
                    if (listResult.ReturnList == null)
                    {
                        listResult.ReturnList = t.Result.ReturnList;
                    }
                    else if (t.Result.ReturnList != null)
                    {
                        listResult.ReturnList.AddRange(t.Result.ReturnList); 
                    }
                } 
                return listResult;
            });
            parentTask.Start();
            parentTask.Wait();
            ReturnItem list = parentTask.Result;
            list.ReturnList.Sort((IndexEntity x, IndexEntity y) => y.Rank.CompareTo(x.Rank));
            return list;
        }
        public static ReturnItem SearchService(QueryItemEntity queryItemEntity, string path)
        {
          ReturnItem r=  SearchBase.MainSearch(queryItemEntity,false ,true ,path );
          return r;
        }
    }
}