HTML 파일의 메타 태그를 추출하고이를 tika 통합으로 solr로 색인하려고합니다. 나는 Tika와 함께 메타 태그를 추출 할 수 없으며 solr에 표시 할 수 없습니다.HTML 파일에서 메타 태그를 추출하고 SOLR 및 TIKA에서 색인을 생성하는 방법
내 HTML 파일은 다음과 유사합니다. 내의 schema.xml 파일에서이
<dataConfig>
<dataSource name="bin" type="BinFileDataSource" />
<document>
<entity name="f" dataSource="null" rootEntity="false"
processor="FileListEntityProcessor"
baseDir="/path/to/html/files/"
fileName=".*html|xml" onError="skip"
recursive="false">
<field column="fileAbsolutePath" name="path" />
<field column="fileSize" name="size"/>
<field column="file" name="filename"/>
<entity name="tika-test" dataSource="bin" processor="TikaEntityProcessor"
url="${f.fileAbsolutePath}" format="text" onError="skip">
<field column="product_id" name="product_id" meta="true"/>
<field column="assetid" name="assetid" meta="true"/>
<field column="title" name="title" meta="true"/>
<field column="type" name="type" meta="true"/>
<field column="first" name="first" meta="true"/>
<field column="category" name="category" meta="true"/>
</entity>
</entity>
</document>
</dataConfig>
같은
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="product_id" content="11"/>
<meta name="assetid" content="10001"/>
<meta name="title" content="title of the article"/>
<meta name="type" content="0xyzb"/>
<meta name="category" content="article category"/>
<meta name="first" content="details of the article"/>
<h4>title of the article</h4>
<p class="link"><a href="#link">How cite the Article</a></p>
<p class="list">
<span class="listterm">Length: </span>13 to 15 feet<br>
<span class="listterm">Height to Top of Head: </span>up to 18 feet<br>
<span class="listterm">Weight: </span>1,200 to 4,300 pounds<br>
<span class="listterm">Diet: </span>leaves and branches of trees<br>
<span class="listterm">Number of Young: </span>1<br>
<span class="listterm">Home: </span>Sahara<br>
</p>
</p>
내 데이터-config.xml 파일을 보면 나는 다음과 같은 필드를 추가했습니다.
<field name="product_id" type="string" indexed="true" stored="true"/>
<field name="assetid" type="string" indexed="true" stored="true" />
<field name="title" type="string" indexed="true" stored="true"/>
<field name="type" type="string" indexed="true" stored="true"/>
<field name="category" type="string" indexed="true" stored="true"/>
<field name="first" type="text_general" indexed="true" stored="true"/>
내 solrconfing.xml 파일에 다음 코드를 추가했습니다.
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler" />
<lst name="defaults">
<str name="config">/path/to/data-config.xml</str>
</lst>
사람은 SOLR 및 티카에있는 HTML 파일과 인덱스 그들로부터 그 메타 태그를 추출하는 방법을 알 수 있습니까? 귀하의 도움을 주시면 감사하겠습니다.
감사 :
그래서, 여기에 수정 solrconfig.xml입니다. 나는 SolrJ 클라이언트가 자바 애플리케이션 용이라고 생각한다. 내 응용 프로그램은 PHP에서이고 SolPHP 클라이언트를 사용하고 있습니다. SolPHP에서 제가 할 수있는 일이 있습니까? –
Tika가 자바에 있습니다. 설정을 통해서만 맵퍼를 설정할 수 있는지 확실하지 않습니다. 그러나 Tika를 모두 건너 뛰고 PHP에서 HTML을 파싱하고 최종 문서를 직접 Solr에게 보내면 더 쉽습니다. –
당신은 solrJ의 작동 방식과 기존의 solr와 어떻게 통합 할 수 있는지 자세히 설명해 주시겠습니까? –