Defining<br>as a "long"or "int"type throws an error on startup

solr를 시작할 때 다음과 같은 예외를 보고합니다.
SEVERE: org.apache.solr.common.SolrException
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:600)
        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:480)
        at org.apache.solr.core.CoreContainer.load(CoreContainer.java:332)
        at org.apache.solr.core.CoreContainer.load(CoreContainer.java:216)
        at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:161)
        at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
        at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.
        at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:202)
        at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:527)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:594)
        ... 32 more
Caused by: java.lang.NumberFormatException: For input string: "MA147LL/A"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:449)
        at java.lang.Integer.parseInt(Integer.java:499)
        at org.apache.solr.schema.TrieField.readableToIndexed(TrieField.java:291)
        at org.apache.solr.handler.component.QueryElevationComponent$ElevationObj.<init>(QueryElevationComponent.java:119)
        at org.apache.solr.handler.component.QueryElevationComponent.loadElevationMap(QueryElevationComponent.java:264)
        at org.apache.solr.handler.component.QueryElevationComponent.inform(QueryElevationComponent.java:186)
        ... 34 more

제 Solr 버전은 3.6.1입니다.
이상 스택을 보려면: Caused by: org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.Caused by:java.lang.NumberFormatException: For input string: "MA147LL/A"
QueryElevationComponent 구성 요소를 초기화하는 데 문제가 발생했습니다.solrconfig에서xml 파일에서 QueryElevationComponent 구성 항목을 찾습니다.
<searchComponent name="elevator" class="solr.QueryElevationComponent">
<!--  pick a fieldType to analyze queries  -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
<!--
 A request handler for demonstrating the elevator component 
-->
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="df">text</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
프로필에서Query ElevationComponent를 초기화할 때 conf 디렉터리에 있는elevate를 불러옵니다.xml 파일이므로 elevate를 엽니다.xml 파일 보기:
<elevate>
 <query text="foo bar">
  <doc id="1" />
  <doc id="2" />
  <doc id="3" />
 </query>
 
 <query text="ipod">
   <doc id="MA147LL/A" />  <!-- put the actual ipod at the top -->
   <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
 </query>
 
</elevate>

id='MA147LL/A'와 id='IW-02'의 설정 항목이 있음을 발견할 수 있습니다. 문제는 id의 값이'MA147LL/A'와 IW-02입니다. 이것은string 형식입니다. 우리가 id를long이나 int 등number 형식으로 정의할 때 상기 이상이 발생합니다.
이것은 solr의 버그입니다.https://issues.apache.org/jira/browse/SOLR-2997
다음과 같은 두 가지 솔루션이 있습니다.
(1) id='MA147LL/A'를 id='1', id='IW-02'를 id='2'로 바꾸고 그 값을 성형한다.
(1)solrconfig에 있습니다.xml 파일에서 다음 코드를 주석합니다. (Query ElevationComponent 구성 요소는 초보자에게 일반적으로 사용하지 않기 때문에 먼저 주석을 달 수 있습니다.)
<searchComponent name="elevator" class="solr.QueryElevationComponent">
<!--  pick a fieldType to analyze queries  -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
<!--
 A request handler for demonstrating the elevator component 
-->
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="df">text</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>

PS: Query Elevation Component 구성 요소는 Solr가 가격 경쟁 랭킹을 실현하는 데 사용되며, 다음은 Solr 가격 경쟁 랭킹에 관한 글을 씁니다.

좋은 웹페이지 즐겨찾기