2014-12-26 2 views
0

Windows OS에 설치된 solr을 사용하여 wikitravels 데이터의 색인을 생성하려고합니다. 다음은 샘플 입력 데이터이다 : 그것은 오류를 표시하지 않습니다, 게시시SOLR - xml 데이터 용 schema.xml 구성

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
<field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/> 
<field name="comments" type="text_general" indexed="true" stored="true"/> 
<field name="text" type="text_general" indexed="true" stored="true" multiValued="true"/> 

<uniqueKey>id</uniqueKey> 

; 내의 schema.xml에서

<?xml version="1.0" encoding="UTF-8"?> 

<add> 
    <page> 
    <title>3Days 2Night Chiang Mai to Chiang Rai</title> 
    <id>83509</id> 
    <revision> 
     <id>1305791</id> 
     <timestamp>2009-11-27T10:35:53Z</timestamp> 
     <contributor> 
     <username>Texugo</username> 
     <id>7666</id> 
     <realname/> 
     </contributor> 
     <comment>[[3Days 2Night Chiang Mai to Chiang Rai]] moved to [[Chiang Mai to Chiang Rai in 3 days]]</comment> 
     <text xml:space="preserve">#REDIRECT [[Chiang Mai to Chiang Rai in 3 days]]</text> 
    </revision> 
    </page> 
</add> 

, 나는 다음과 같은 변경 사항을 추가했습니다 그러나 SOLR 웹에서는 데이터를 표시하지 않습니다. 또한 로그에 오류가 표시 될 수 있습니다.

$ java -jar post.jar wiki.xml 
SimplePostTool version 1.5 
Posting files to base url http://localhost:8983/solr/update using content-type application/xml.. 
POSTing file wiki.xml 
1 files indexed. 
COMMITting Solr index changes to http://localhost:8983/solr/update.. 
Time spent: 0:00:00.342 

답변

1

같아야을 SOLR 입력 XML은 특정있다 형태.

  1. 전송 데이터를 XML 파싱 할 수있는 사용 DataImportHandler
  2. the XML format Solr expects에서와
  3. Pre-process XML with XSLT on the way in는 XML SOLR가 기대하는 것처럼 보이게하는 방법 : 당신은 할 수 있습니다.
  4. 사용 JSON과

pre-process that는 그 옵션 2 (DataImportHandler)는 타사 XML 파일을 사용하는 경우 가장 쉬운 방법이 될 수 있습니다 의심. 또한 DIH는 매우 큰 XML 파일을 읽을 때 가져올 수 있습니다. 큰 파일을 Solr에 게시하면 크기 제한이 발생할 수 있습니다.

0

documentation에 따라 XML이 형식이 있어야합니다 @notdang 말했듯이

<add> 
    <doc> 
    <field name="employeeId">05991</field> 
    <field name="office">Bridgewater</field> 
    <field name="skills">Perl</field> 
    <field name="skills">Java</field> 
    </doc> 
    [<doc> ... </doc>[<doc> ... </doc>]] 
</add> 

그래서 당신의 XML이

<?xml version="1.0" encoding="UTF-8"?> 

<add> 
    <doc> 
    <field name="title">3Days 2Night Chiang Mai to Chiang Rai</field> 
    <field name="id">83509</field> 
    <field name="revision_id"> 1305791</field> 
    <field name="revision_timestamp">2009-11-27T10:35:53Z</field> 
    .... 
    </doc> 
</add>