chenlb / mmseg4j-solr Goto Github PK
View Code? Open in Web Editor NEWmmseg4j for lucene or solr analyzer
License: Apache License 2.0
mmseg4j for lucene or solr analyzer
License: Apache License 2.0
如何在分词时区分大小写呢? 现在分词时就直接将原始词转为小写了,能不能在分词时可以指定是否是区分大小写?
1.91版本,中文中加入空格好像就不能正确的分词了,不知道有没有遇到过。 比如我搜索“你好 世界”,和“你好”以及“世界”的结果都查询不到,但是连起来搜索“你好世界”的时候,就可以查出两个词语的结果。
solr 4.8已发布
fbd3cf4 加入代码格式模板
要求用户搜素某个词的前几个字也可以得到结果。以“连衣裙”为例,maxword分词结果为“连 | 衣裙”。要求用户搜索“连”或“连衣”都要有结果。我看了下淘宝和京东目前能做到这一点。
这一点现在可以通过模糊查询实现,但担心对较短的中文字词进行频繁模糊查询会影响性能(这个究竟影响多少尚未实测),我希望用空间换时间。
我的解决方案如下:
1、先用mmsege4j进行正常分词
2、将上面正常分词中长度大于等于3的词的前缀也分出来,不管它是不是一个正常的词,比如是“连衣裙”就把“连衣”也分出来。
3、将整个句子分成单字
最后的结果是上面3个集合的和。
这种方案是否能解决我提到的问题?
在solr6上现出 org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.update.processor.LangDetectLanguageIdentifierUpdateProcessorFactory'
我集成到solr7.7中总是报错,有没有解决过这问题的?
possible analysis error: startOffset must be non-negative, and endOffset must be >= startOffset, and offsets must not go backwards startOffset=4,endOffset=15,lastStartOffset=11 for field 'msg'
solr 4.10.4
mmseg4j 2.2.0
自定义词库“女式”,
"parsedquery_toString": "text:女 text:式"
但是其他自定义词如“女款”却可以
另外,我把jar包里的词库去掉,放到dicPath下,加入"女式",却又生效,折腾好长时间了。。
另,拿最新源码跑单元测试好像是正常的。
初接触solr,如有理解错误,见谅
你好,我使用的是mmseg4j-core-1.9.1,在介绍中,我看到了“1.6版在complex基础上实现了最多分词(max-word)。“很好听” -> "很好|好听"; “中华人民共和国” -> "中华|华人|共和|国"; “**人民银行” -> "**|人民|银行"。”
我使用了自定义的中文词库,总共有60多万个词条,但是我在Solr Admin中测试发现complex并没有实现最多分词。
比如我输入:“中华人民共和国",则分词的结果为:”中华人民共和国“,我输入”很好听的一首歌曲“,则分词的结果为:”很好听“,”一首“,”歌曲“。我想请问下是不是我需要配置什么filter之类吗,下面是我的配置:
分词搜索后排序效果有问题,
没有按相关度排序是什么原因?
感谢你的出色贡献。是否可以提供更详细的文档与配置说明?
比如对版本的要求,程序文件应该放置到那个目录?应该修改哪个配置文件等等。
java.lang.ClassNotFoundException: com.chenlb.mmseg4j.Seg
solr-5.0 mmseg4j-solr-2.3.0
import mmseg4j-core-1.0.0 fix it
solr6.0需要java1.8环境,然而2.3版本的mmseg4j在被solr加载的时候,出现了错误,不知道如何解决
分为两个包可能更合适一些,对于一些应用来讲,不需要用到solr,比如elasticsearch。
經過測試,1.9.1 2.0.0 2.0.1 都跟 solr 4.2.1 不合。
不過我想也不用修了,在 readme 寫個警告即可。
我升上 4.3 就沒問題了。
Caused by: org.apache.solr.common.SolrException: Error instantiating class: 'com.chenlb.mmseg4j.solr.MMSegTokenizerFactory'
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:473)
at org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:89)
at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:151)
... 16 more
Caused by: java.lang.InstantiationException: com.chenlb.mmseg4j.solr.MMSegTokenizerFactory
at java.lang.Class.newInstance(Class.java:359)
at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:470)
... 18 more
org.apache.lucene.search.highlight.InvalidTokenOffsetsException: Token ikanalyz exceeds length of provided text sized 79
at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:225)
at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:156)
at org.apache.lucene.search.highlight.Highlighter.getBestFragment(Highlighter.java:102)
at com.ifweb.web.search.SearchLogic.highlightFormat(SearchLogic.java:265)
at com.ifweb.web.search.SearchLogic.addHits2List(SearchLogic.java:186)
at com.ifweb.web.search.SearchLogic.getResult(SearchLogic.java:67)
at com.ifweb.web.search.SearchLogic.main(SearchLogic.java:233)
Token ikanalyz exceeds length of provided text sized 79
求解答
b352987 标准化 pom。加入nexus-staging、jgitflow、release 插件。
1、标点符号搜索不到的问题。
我已经解决了 http://www.cnblogs.com/wgp13x/p/4502178.html
可是要不要在配置文件中给用户可配?
2、英文加数字 分成一个词的问题。
一般不符合常理,英文可以分成一个词,数字再分成一个词,现在是他们组合成一个词,导致只搜英文或数字搜索不到。是不是也可给用户可配?
目前测试 lucene/solr [6.0.0, 6.3.0] 通过。
在搜索引擎创建索引时,我需要同时按粗颗粒度和细颗粒度分词,有什么办法能实现吗?
啥时候支持solr5.0呢?
你好,像“T恤”这样的词分不出来,即使在自定义词库增加这样的词 也分不出来,谢谢!
比如“哈尔滨市” 用Complex和Simple模式都会只会分出来“哈尔滨市” 而不能分出来“哈尔滨市”和“哈尔滨”,用MaxWord分出来了“哈”,“尔”,“滨”,“市”,这个要怎么解决呢?感谢作者。
这玩意儿怎么编译成jar啊?
Solr下,高亮不生效,测试版本4.9 4.91 4.10.3
通过solr自带的http://localhost:8983/solr/#/collection1/query做测试。
Solr自带的方式可以正常高亮搜索词。
当把field content的type由text_general改为textComplex后。
能返回搜索结果,但是高亮只有ID没有具体内容
在solr6.1中,getInstanceDir()已经被换为getInstancePath(),请作者进行升级。
在现有版本中,要避免该函数带来的问题,需要在设置dicpath的时候使用绝对路径,而不要使用相对路径
神啊!救救我吧!
window + tomcat9 +solr6.3 + mmseg4j-core-1.10.0 + mmseg4j-analysis-1.9.1 + mmseg4j-solr-2.4.0
`
<fieldtype name="aComplex" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="complex" dicPath="C:/solr/fenchi"/>
</analyzer>
</fieldtype>
<fieldtype name="aMaxWord" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="max-word" />
</analyzer>
</fieldtype>
<fieldtype name="aSimple" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode="simple" dicPath="C:/solr/fenchi"/>
</analyzer>
</fieldtype>
`
警告: defalut dic path=file:\D:\solr-5.4.1\server\solr-webapp\webapp\WEB-INF\lib\mmseg4j-core-1.10.0.jar!\data not exist
資訊: try to load dir=file:\D:\solr-5.4.1\server\solr-webapp\webapp\WEB-INF\lib\mmseg4j-core-1.10.0.jar!\data
Jul 05, 2016 4:22:50 上午 com.chenlb.mmseg4j.Dictionary loadDic
資訊: chars loaded time=21ms, line=12638, on file=file:\D:\solr-5.4.1\server\solr-webapp\webapp\WEB-INF\lib\mmseg4j-core-1.10.0.jar!\data\chars.dic
...
<requestHandler name="/mmseg4j" class="com.chenlb.mmseg4j.solr.MMseg4jHandler" >
<lst name="defaults">
<str name="dicPath">mydic</str>
<str name="check">true</str>
<str name="reload">false</str>
<str name="mode">simple</str>
</lst>
</requestHandler>
我有兩件事不解:
(1) 字典目錄預設應該是在mmseg4j-core-1.10.0.jar裡面的data目錄,我也確定這個目錄和裡面的字典檔案確實存在,但是為何上面的警告訊息顯示"not exist". jar!的驚嘆號是什麼意思?我如果讓這個警告消失?
(2) 在宣告request handler時,我預設了dicPath的值為mydic。為什麼上面訊息顯示出仍然是由jar檔中的dat目錄下讀取字典檔?另外mydic目錄應該建立在哪裡?
当前似乎不支持Solr7
我只想调用一下对字符串分词一下,可是没有介绍,不知道怎么用,网上也搜不到说明、
难道靠猜?
运行测试用例报 "java.lang.AssertionError: fix your classpath to have tests-framework.jar before lucene-core.jar" 错。
java.lang.AssertionError: fix your classpath to have tests-framework.jar before lucene-core.jar
at __randomizedtesting.SeedInfo.seed([A21B138876C58AF1]:0)
at org.apache.lucene.util.TestRuleSetupAndRestoreClassEnv.before(TestRuleSetupAndRestoreClassEnv.java:187)
at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:42)
at com.carrotsearch.randomizedtesting.rules.SystemPropertiesInvariantRule$1.evaluate(SystemPropertiesInvariantRule.java:55)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.