huaban / jieba-analysis

结巴分词(java版)
https://github.com/huaban/jieba-analysis
Apache License 2.0
2.59k stars 839 forks source link

build的时候出错 #20

Open hhy5861 opened 9 years ago

hhy5861 commented 9 years ago

build的时候出错 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.4:sign (sign-artifacts) on project jieba-analysis: Exit code: 2 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

hhy5861 commented 9 years ago

5.3.1配置了导入数据出错了。

951040 INFO (Thread-19) [ x:Restaurant_Index] o.a.s.u.p.LogUpdateProcessor [Restaurant_Index] webapp=/solr path=/dataimport params={debug=false&optimize=false&indent=true&commit=true&clean=true&wt=json&command=full-import&entity=Restaurant_Index&verbose=false} status=0 QTime=3 {deleteByQuery=: (-1517990524086124544)} 0 267 Exception in thread "Thread-19" java.lang.NoSuchFieldError: word at analyzer.solr5.jieba.JiebaTokenizer.incrementToken(JiebaTokenizer.java:38) at org.apache.lucene.analysis.util.FilteringTokenFilter.incrementToken(FilteringTokenFilter.java:51) at org.apache.lucene.analysis.core.LowerCaseFilter.incrementToken(LowerCaseFilter.java:45) at org.apache.lucene.analysis.snowball.SnowballFilter.incrementToken(SnowballFilter.java:90) at org.apache.lucene.index.DefaultIndexingChain$PerField.invert(DefaultIndexingChain.java:613) at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:344) at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:300) at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:234) at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:450) at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1475) at org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:239) at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:163) at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69) at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51) at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:955) at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1110) at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:706) at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:104) at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:71) at org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:259) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:524) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480) at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:461)

piaolingxue commented 8 years ago

@hhy5861 你好,

第一个问题:正常执行 mvn package 不会调用 sign 这个过程。

第二个问题:请问 class analyzer.solr5.jieba.JiebaTokenizer 是不是写的有问题,可否贴详细代码进一步定位问题。

hhy5861 commented 8 years ago

package analyzer.solr5.jieba;

import com.huaban.analysis.jieba.SegToken; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.TypeAttribute;

import java.io.IOException; import java.io.Reader;

public class JiebaTokenizer extends Tokenizer {

private CharTermAttribute termAtt;
private OffsetAttribute offsetAtt;
private TypeAttribute typeAtt;
private int endPosition;

private JiebaAdapter jieba;

protected JiebaTokenizer(String segModeName, String userDictPath) {

    this.offsetAtt = addAttribute(OffsetAttribute.class);
    this.termAtt = addAttribute(CharTermAttribute.class);
    this.typeAtt = addAttribute(TypeAttribute.class);

    jieba = new JiebaAdapter(input, segModeName, userDictPath);

}

@Override
public boolean incrementToken() throws IOException {
    clearAttributes();
    if(jieba.hasNext()){
        SegToken token = jieba.next();
        termAtt.append(token.word.getToken());
        termAtt.setLength(token.word.length());
        offsetAtt.setOffset(token.startOffset, token.endOffset);
        endPosition = token.endOffset;
        typeAtt.setType(token.word.getTokenType());         
        return true;
    }
    return false;
}

@Override
public void end() throws IOException {
    int finalOffset = correctOffset(this.endPosition);
    offsetAtt.setOffset(finalOffset, finalOffset);
}

@Override
public void reset() throws IOException {
    super.reset();
    jieba.reset(this.input);
}

}

piaolingxue commented 8 years ago

@hhy5861 请问你引用的是什么版本,1.* 以上版本 word 已经不是一个对象,(之前有个支持词性标注的版本,word 是个对象,后来因为词性标注影响性能,把那个 commit 撤掉了,word 也回归成 string 类型)

xiehengye commented 7 years ago

您好,请问我在执行mvn install 命令的时候报下面的错误,是什么原因该怎么解决》谢谢! [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (sign-artifacts) on project jieba-analysis: Unable to execute gpg command: Error while executing process. Cannot run program "gpg.exe": CreateProcess error=2, 系统找不到指定的文件。 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException