我有一个在更新solr(4.6)文档时随机复制的问题。
"error": { "msg": "first position increment must be > 0 (got 0) for field 'any_field'", "trace": "java.lang.IllegalArgumentException: first position increment must be > 0 (got 0) for field 'any_field' org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:125) org.apache.lucene.index.DocFieldProcessor.processDocument(DocFieldProcessor.java:248) org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:253) org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:453) org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1520) org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:217) org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69) org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51) org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:569) org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:705) org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:435) org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100) org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.processUpdate(JsonLoader.java:126) org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.load(JsonLoader.java:101) org.apache.solr.handler.loader.JsonLoader.load(JsonLoader.java:65) org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92) org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74) org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) org.apache.solr.core.SolrCore.execute(SolrCore.java:1859) org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:710) org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:413) org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:197) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:744)", "code": 500 }
any_field的分析器如下:
<fieldType name="text_paoding" class="solr.TextField"/>
<analyzer class="net.paoding.analysis.analyzer.PaodingAnalyzer"/></analyzer/>
</fieldType/>