huangfox

冰冻三尺,非一日之寒!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  194 随笔 :: 4 文章 :: 106 评论 :: 105万 阅读

随笔分类 -  3-搜索引擎_Lucene

1 2 3 下一页

摘要:SolrQuerySyntaxhttp://wiki.apache.org/solr/SolrQuerySyntaxsolr的处理方式:https://svn.apache.org/repos/asf/lucene/dev/trunk/solr/solrj/src/java/org/apache/s... 阅读全文
posted @ 2014-12-29 14:54 huangfox 阅读(1843) 评论(0) 推荐(0) 编辑

摘要:原文地址http://wiki.apache.org/solr/DocValuesDocValues从Lucene4.2和Solr4.2开始加入,通过建立字段的正排索引,提升sorting, faceting, grouping, function queries等性能。介绍在Solr的配置文件(s... 阅读全文
posted @ 2014-12-23 23:27 huangfox 阅读(534) 评论(0) 推荐(0) 编辑

摘要:Facets with LucenePosted onAugust 1, 2014byPascal DimassimoinLatest ArticlesDuring the development of our latest product,Norconex Content Analytics, w... 阅读全文
posted @ 2014-12-22 17:29 huangfox 阅读(767) 评论(0) 推荐(0) 编辑

摘要:package com.fox.facet;/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file d... 阅读全文
posted @ 2014-12-22 11:51 huangfox 阅读(1067) 评论(1) 推荐(0) 编辑

摘要:package com.fox.facet;import java.io.IOException;import java.util.ArrayList;import java.util.List;import org.apache.lucene.analysis.core.WhitespaceAna... 阅读全文
posted @ 2014-12-22 11:44 huangfox 阅读(960) 评论(0) 推荐(0) 编辑

摘要:package com.fox.facet;import java.io.File;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.List;import o... 阅读全文
posted @ 2014-12-22 11:03 huangfox 阅读(631) 评论(0) 推荐(0) 编辑

摘要:在某些场景需要做自定义排序(非单值字段排序、非文本相关度排序),除了自己重写collect、weight,可以借助CustomScoreQuery。场景:根据tag字段中标签的数量进行排序(tag字段中,标签的数量越多得分越高)public class CustomScoreTest { pu... 阅读全文
posted @ 2014-09-03 20:58 huangfox 阅读(2611) 评论(0) 推荐(1) 编辑

摘要:环境搭建一.zookeeper参考:http://blog.chinaunix.net/uid-25135004-id-4214399.html现有4台机器 10.14.2.201 10.14.2.202 10.14.2.203 10.14.2.204安装zookeeper集群 在所有机器上进行1、... 阅读全文
posted @ 2014-08-18 19:55 huangfox 阅读(12887) 评论(2) 推荐(0) 编辑

摘要:http://blog.csdn.net/accesine960/article/details/80668772012年10月12日,Lucene 4.0正式发布了(点击这里下载最新版),这个版本因为诸多的新特性和大胆的架构调整一直备受期待。无论是索引结构,索引算法以及整体架构的包容性都发生了翻天... 阅读全文
posted @ 2014-05-09 09:43 huangfox 阅读(672) 评论(0) 推荐(0) 编辑

摘要:TheBig Data Zoneis presented bySplunk, the maker of data analysis solutions such asHunk, an analytics tool for Hadoop, and theSplunk Web Framework.Liv... 阅读全文
posted @ 2014-05-07 13:46 huangfox 阅读(1330) 评论(0) 推荐(0) 编辑

摘要:一)分词1)正向/逆向最大匹配算法典型:IKAnalyzer采用的是正向迭代最细粒度切分算法IKAnalyzer源码简单分析:http://www.cnblogs.com/huangfox/p/3282003.html2)字典树(trieTree)trieTree实现http://www.cnblogs.com/huangfox/archive/2012/04/27/2474185.html中文分词遇到的问题:a)标准trieTree节点采用数组存储指针,如果是英文a-z用26长度的数组表示,但是中文不能用这种存储方式,节点数组长度等于中文字数。(内存撑不住!)b)如何节点内部查询?采用数组进 阅读全文
posted @ 2014-01-17 18:14 huangfox 阅读(4127) 评论(0) 推荐(0) 编辑

摘要:在文本搜索中,有时也需要一次搜索多个id,这里id类似数据库里面的主键。这个id在索引里面的倒排列表长度往往等于1.例如:根据id=[1,2,4,6,7]查询索引最最一般的思路是构造一个booleanQuery,然后add 5个TermQuery,用should逻辑。但是这个检索效率肯定不行。可行的一个办法是:TermDocs td = null;//int[] docIds = new int[ids.length];//存放结果int count = 0 ;td = search.getIndexReader().termDocs();for(id : ids){ td.seek(new 阅读全文
posted @ 2013-07-11 10:39 huangfox 阅读(1747) 评论(0) 推荐(0) 编辑

摘要:Ifound in lucene 3.5 contrib folder two plugins: one is grouping, the other is facet. In my option, both of them were used to split my documents into ... 阅读全文
posted @ 2013-06-27 16:13 huangfox 阅读(342) 评论(0) 推荐(0) 编辑

摘要:问题的引入:Hello, I am using the reopen method in the IndexReader class. In the caseof the IndexReader being updated, I would like to create a new IndexSearcherand close the old IndexReader. When closing an instance of IndexReader, do Ihave to wait for currently executing searches (through an IndexSearch 阅读全文
posted @ 2013-06-07 17:02 huangfox 阅读(682) 评论(0) 推荐(0) 编辑

摘要:NRT原理When you ask for the IndexReader from the IndexWriter, the IndexWriter will be flushed (docs accumulated in RAM will be written to disk) but not committed (fsync files, write new segments file, etc).The returned IndexReader will search over previously committed segments, as well as the new, flu 阅读全文
posted @ 2012-08-21 14:37 huangfox 阅读(3126) 评论(7) 推荐(1) 编辑

摘要:面对字段类型为数值时,lucene表现得并不是很完美,经常会带来一些意想不到的“问题”。下面从索引、排序、范围检索(rangeQuery)三个方面进行分析。搜索我们做好准备工作,建立索引。RAMDirectory dir = new RAMDirectory(); public void index() { Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_36); try { IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( Versi... 阅读全文
posted @ 2012-08-10 09:15 huangfox 阅读(10095) 评论(0) 推荐(0) 编辑

摘要:lucene的打分需要用到优先级队列,他是基于“堆”实现的。PriorityQueue是一个抽象方法,要求子类实现一个“比较方法”!PriorityQueue的源码如下:package org.apache.lucene.util;/** * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with 阅读全文
posted @ 2012-07-11 14:29 huangfox 阅读(2146) 评论(0) 推荐(0) 编辑

摘要:对于lucene的统计,我基本放弃使用factedSearch了,效率不高,而且两套索引总觉得有点臃肿!这次我们通过改造Collector,实现简单的统计功能。经过测试,对几十万的统计还是比较快的。首先我们简单理解下Collector在search中的使用情况!Collector是一个接口,主要包括以下重要方法:public abstract class Collector { //指定打分器 public abstract void setScorer(Scorer scorer) throws IOException; //对目标结果进行收集,很重要! public abstrac... 阅读全文
posted @ 2012-07-10 15:35 huangfox 阅读(5184) 评论(1) 推荐(1) 编辑

摘要:MoreLikeThis,相似检索。找出某篇文档的相似文档,常见于“类似新闻”、“相关文章”等,这里完全是基于内容的分析。1)MoreLikeThis的使用 FSDirectory directory = SimpleFSDirectory.open(new File("d:/nrtTest2")); IndexReader reader = IndexReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader); // MoreLikeThis mlt = new ... 阅读全文
posted @ 2012-07-05 17:22 huangfox 阅读(3537) 评论(0) 推荐(0) 编辑

摘要:最近两天重新梳理了下lucene的打分算法,是基于1.9版本的(原理一致那么就选个简单的版本来看看,看着也简单利落)。编辑那些公式什么的也繁琐,就直接贴草稿图吧,偷个懒!1)打分公式公式的2、4、5部分只是和query相关,这部分计算在weight中完成!!!2)构建weight一下都是对termQuery进行分析,这里构建的也是TermWeight。weight的属性value为上述公式2、4、5部分的乘积,及query的权重。打分的过程本来就是query的权重和命中document权重的运算,这里先计算出query的权重,后面的时候交给score完成。这相当于是一个准备的工作!3)构建sc 阅读全文
posted @ 2012-07-02 16:15 huangfox 阅读(2717) 评论(1) 推荐(0) 编辑

1 2 3 下一页
点击右上角即可分享
微信分享提示