gigaZhang / mmseg4j

Automatically exported from code.google.com/p/mmseg4j
Apache License 2.0
0 stars 0 forks source link

mmseg4j 1.9.0 在 lucene 4 下建不了索引 #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

Document doc = new Document();

            doc.add(new TextField("content",  "This is the text to be indexed.", Field.Store.YES));
            doc.add(new TextField("addr", "河北", Field.Store.YES));
            indexWriter.addDocument(doc);
indexWriter.close();

只能建立 addr 的索引,不能创建content 
的索引,只能对一个字段建索引,会是什么原因?

Original issue reported on code.google.com by wonderfu...@163.com on 25 Oct 2012 at 3:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
贴个完整代码:
Analyzer analyzer = new MMSegAnalyzer();
Directory directory = FSDirectory.open(new File("f:/tmp/testindex"));
            IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
            config.setOpenMode(OpenMode.CREATE);
            IndexWriter iwriter = new IndexWriter(directory, config);

            Document doc = new Document();
            doc.add(new TextField("a", "基本地工仍然", Field.Store.YES));
            doc.add(new TextField("b", "中国服装", Field.Store.YES));
            iwriter.addDocument(doc);

            iwriter.commit();
            iwriter.close();

并没对 "中国服装" 进行分词。

Original comment by wonderfu...@163.com on 25 Oct 2012 at 3:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
问题同楼上,"基本地工仍然" 和 "中国服装" 都没有进行分词 
索引

Original comment by chuchuli...@foxmail.com on 6 Jan 2013 at 6:25

GoogleCodeExporter commented 8 years ago
http://mmseg4j.googlecode.com/files/mmseg4j-1.9.1.v20130120-SNAPSHOT.zip 
解决了 lucene 4.0 的分词接口问题。

Original comment by chenlb2...@gmail.com on 20 Jan 2013 at 4:38

GoogleCodeExporter commented 8 years ago
使用 2.0.0

参考 https://github.com/chenlb/mmseg4j-solr

Original comment by chenlb2...@gmail.com on 19 May 2014 at 11:26