Loading

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 52 下一页
摘要: Lucene中索引阶段Boost的值会被存放在.nrm文件中,用16进制打开就能看的到。每个Boost值最终会被保存于一个Byte中,如果细心的同学就会发现在SetBoost的时候参数类型是float,float是四个字节的,也就是说最后会有精度丢失。废了方便查询给出代码和0-255对应的float下面是换算的代码: public static sbyte FloatToByte315(float f) { int num = BitConverter.ToInt32(BitConverter.GetBytes(f), 0); ... 阅读全文
posted @ 2012-05-22 15:31 today4king 阅读(1447) 评论(0) 推荐(0) 编辑
摘要: 今天写了个单元测试,看看权重的变化,结果发现索引的时候啥都好好的,索引完拿出来看都是1,困惑了好一会,还好lucene的文档给出了解释:getBoostpublic float getBoost()Returns, at indexing time, the boost factor as set by setBoost(float).Note that once a document is indexed this value is no longer available from the index. At search time, for retrieved documents, thi 阅读全文
posted @ 2012-05-15 17:56 today4king 阅读(1460) 评论(2) 推荐(0) 编辑
摘要: Stone_W 同学写了一篇《LINQ能不能用系列(一)数组筛选效率对比》错误一:作为对比测试,测试数组应该为同一个,否则测试数据没有可比性错误二:对比组中对List的使用不对,List默认创建的数组大小为4,每次增长为4,那么这里就会反复重新创建新的数组次数为log10000000次左右当然会比Linq慢很多错误三:面对Linq接近0毫秒的处理能力,稍微有点经验的同学就知道这是不可能的,除非是很强很强的计算机,至于为什么后面给出答案,总之linq查询里肯定有猫腻,直接调用tolist()强制返回结果再说;//这里Stone W在评论中对ToList有质疑,我之所以ToList是为了和第二组进 阅读全文
posted @ 2012-05-08 18:28 today4king 阅读(2891) 评论(10) 推荐(4) 编辑
摘要: 入门第一式:IndexReader.Open(Dir,readOnly);当readOnly为true的时候效率最高,最好不要用Reader删除修改记录;入门第二式:reader.Reopen(readOnly);优点:比第一式效率高,推荐使用;缺点:前提是需要有Reader存在;入门第三式:writer.GetReader();优点:NRL的实现,对实时性要求高的不二选择;缺点:writer说它很痛苦,因为每次调用内部都会flush一次以保证所有index会被启用;追求效率(中阶): public class IndexReaderProxy { ... 阅读全文
posted @ 2012-05-03 18:27 today4king 阅读(649) 评论(0) 推荐(0) 编辑
摘要: public class DictionaryCacheManager<TK,TV> { private Dictionary<TK, TV> cacheDic = new Dictionary<TK,TV>(); private Dictionary<TK, object> lockDic = new Dictionary<TK, object>(); public TV Get(TK key,Func<TV> getValue) { if(!CheckKey(key)) { ... 阅读全文
posted @ 2012-04-20 22:46 today4king 阅读(457) 评论(2) 推荐(0) 编辑
摘要: 问题具体见:http://q.cnblogs.com/q/34874/相应站点的w3wp.exe 会意外终止EventLog中的信息:An unhandled exception occurred and the process was terminated. Application ID: DefaultDomain Process ID: 43644 Exception: System.Runtime.Serialization.SerializationException Message: Unable to find assembly 'Lucene.Net, Version= 阅读全文
posted @ 2012-04-19 13:14 today4king 阅读(1741) 评论(0) 推荐(1) 编辑
摘要: 虽然是很久了的数据,还是有很好的参考价值的:lucene.commit.batch.size=0 lucene.commit.time.interval=0 These properties allow commits in batch, you can either set how many document changes a batch will contain (commit will happen after X docs are modified) or set a time interval in milliseconds (commit will happen ever... 阅读全文
posted @ 2012-04-12 18:35 today4king 阅读(1995) 评论(0) 推荐(0) 编辑
摘要: 引自 http://www.nowamagic.net/webdesign/webdesign_ShortUrlInTwitter.php 短网址应用已经在全国各大微博上开始流行了起来。例如QQ微博的url.cn,新郎的sinaurl.cn等。 我们在QQ微博上发布网址的时候,微博会自动判别网址,并将其转换,例如:http://url.cn/2hytQx 为什么要这样做的,原因我想有这样几点: 微博限制字数为140字一条,那么如果我们需要发一些连接上去,但是这个连接非常的长,以至于将近要占用我们内容的一半篇幅,这肯定是不能被允许的,所以短网址应运而生了。 短网址可以在我们项目里可以很好的对开. 阅读全文
posted @ 2012-04-08 00:20 today4king 阅读(2900) 评论(0) 推荐(0) 编辑
摘要: 因为正好解决了手头一个泄漏的问题,正好做个总结。一开始我认为托管代码是不存在泄漏问题的(不使用指针,不操作unsafe的代码) ,我想跟我这样想的人应该不少,呵呵。传统的内存泄漏主要是因为使用后没有释放造成的(维基解释http://en.wikipedia.org/wiki/Memory_leak),而在托管平台下内存的回收是由gc完成,所以托管中出现内存泄漏一般都是因为gc无法分辨对象是否可以被回收造成的,而最常见的就是循环引用,另外委托也是重灾区,4.0中引入的task也成为新的增长点(插播新闻http://news.cnblogs.com/n/124603/)。(插播新闻:在我的代码中大 阅读全文
posted @ 2012-04-01 13:33 today4king 阅读(354) 评论(0) 推荐(0) 编辑
摘要: data:[{name:"北京",cities:["西城","东城","崇文","宣武","朝阳","海淀","丰台","石景山","门头沟","房山","通州","顺义","大兴","昌平","平谷","怀柔","密云","延庆 阅读全文
posted @ 2012-04-01 10:36 today4king 阅读(16360) 评论(1) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 52 下一页