Export to GitHub

bobo-browse - issue #33

bobo最新源代码的问题


Posted on Jul 16, 2010 by Helpful Dog

您好! 首先我非常感谢您们共享出您们的成果。 现在我正在开发基于Lucene的搜索引擎,其中对于分组统计一块还是空白,而查询到您们开源的boboBrowse这个项目。我现在的项目采用最新版本的Lucene3.0.2和同步下来的最新版的paoding(庖丁解牛分词器),运行下面一段代码: public class TestBoBo { public static void main(String[] args) throws BrowseException, IOException, ParseException{ // opening a lucene index Directory idx = FSDirectory.open(new File("D:/DATAMANAGER/SEARCH/INDIVIDUAL")); IndexReader reader = IndexReader.open(idx); // decorate it with a bobo index reader BoboIndexReader boboReader = BoboIndexReader.getInstance(reader); // creating a browse request BrowseRequest br=new BrowseRequest(); br.setCount(10); br.setOffset(0); // parse a query QueryParser qp = new QueryParser(Version.LUCENE_CURRENT,"content",new PaodingAnalyzer()); Query q=qp.parse("广"); br.setQuery(q); // add the facet output specs FacetSpec colorSpec = new FacetSpec();

colorSpec.setMaxCount(10); colorSpec.setOrderBy(FacetSortSpec.OrderHitsDesc); br.setFacetSpec("catCode",colorSpec); // perform browse Browsable browser=new BoboBrowser(boboReader); BrowseResult result=browser.browse(br); int totalHits = result.getNumHits(); BrowseHit[] hits = result.getHits(); Map<String,FacetAccessible> facetMap = result.getFacetMap(); FacetAccessible colorFacets = facetMap.get("catCode"); List facetVals = colorFacets.getFacets();

for(int i=0;i<facetVals.size();i++){ BrowseFacet o = (BrowseFacet)facetVals.get(i); System.out.println(o.getHitCount()+"-----"+o.getValue()); } } }

bobo.spring配置文件如下: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;

<bean id="catCode" class="com.browseengine.bobo.facets.impl.PathFacetHandler"> <constructor-arg value="catCode" /> <property name="separator" value="/" /> </bean>

<bean id="handlers" class="java.util.ArrayList"> <constructor-arg> <list> <ref bean="catCode" /> </list> </constructor-arg> </bean>

导入jar包到我的项目里运行可以看到结果为: 1058-----100003330001000100050001 1056-----100003330001000100050002 698-----10000333000100020004 385-----100003330001000200050001 217-----100003330001000300050002 157-----10000333000100030004 131-----100003330001000400050001 92-----10000333000100040004 78-----10000333000100010004 75-----100003330001000200050002 但是下载您网站上提供的源代码javasoze-bobo-03219a1.zip单独运行测试代码输出结果为: 4041----- 发现网上下载打的jar包的class文件与下载源代码编译后class文件并不完全相同,请问是不是javasoze-bobo-03219a1.zip源代码并不是bobo-browse-2.5.0-rc1.jar的源代码? 还想请教的是: 1、bobo.spring文件必须放在索引文件所在目录下吗?能否配置在classpath路径下?因为我的索引文件是分多目录存储,而且有重建索引的需求。 2、如我的分类编码是100003330001000200050002:这里每4位为一个分类级别, 1000 10000333 100003330001 1000033300010002 10000333000100020005 100003330001000200050002 除了在path切面的方式采用分隔符如"/"来统计,可不可以设置某几位数做一个分隔来统计,而且我们这个分类是无限极生成下去,所以并不需要对所有分类进行统计,可能只需要统计前面三四级,请问是否有接口可以根据自己的需求去自定义? 请问bobo这个项目是否有API或一些文档资料提供?

Comment #1

Posted on Jul 16, 2010 by Helpful Dog

刚又通过svn同步了一下源代码,运行测试程序结果没问题了。但以下几个问题还未能解决: 1、bobo.spring文件必须放在索引文件所在目录下吗?能否配置在classpath路径下?因为我的索引文件是分多目录存储,而且有重建索引的需求。 2、如我的分类编码是100003330001000200050002:这里每4位为一个分类级别, 1000 10000333 100003330001 1000033300010002 10000333000100020005 100003330001000200050002 除了在path切面的方式采用分隔符如"/"来统计,可不可以设置某几位数做一个分隔来统计,而且我们这个分类是无限极生成下去,所以并不需要对所有分类进行统计,可能只需要统计前面三四级,请问是否有接口可以根据自己的需求去自定义? 请问bobo这个项目是否有API或一些文档资料提供?

Status: New

Labels:
Type-Defect Priority-Medium