示例 HTML文件是
<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 ><a href="#link">How cite the Article</a></p><p > <span >Length: </span>13 to 15 feet<br> <span >Height to top of head: </span>up to 18 feet<br> <span >Weight: </span>1,200 to 4,300 pounds<br> <span >DIEt: </span>leaves and branches of trees<br> <span >Number of Young: </span>1<br> <span >Home: </span>Sahara<br></p></p>
我在solrconfing.xml文件中添加了请求处理程序.
<requestHandler name="/dataimport" ><lst name="defaults"> <str name="config">/path/to/data-config.xml</str></lst>
我的data-config.xml看起来像这样
<dataConfig><dataSource type="fileDataSource" /><document> <entity name="f" processor="fileListEntityProcessor" baseDir="/path/to HTML/files/" filename=".*HTML" recursive="true" rootEntity="false" dataSource="null"> <fIEld column="plainText" name="text"/> </entity></document></dataConfig>
我保留了默认的schema.xml文件,并将以下代码添加到schema.xml文件中.
<fIEld name="product_ID" type="string" indexed="true" stored="true"/> <fIEld name="assetID" type="string" indexed="true" stored="true" required="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"/> <uniqueKey>assetID</uniqueKey>
当我在设置它之后尝试进行完全导入时,它显示所有HTML文件都已获取.但是当我在SolR中搜索时,它没有向我显示任何结果.任何人都知道可能的原因是什么?
我的理解是所有文件都正确获取但未在SolR中编入索引.有谁知道如何在SolR中索引那些元标记和HTML文件的内容?
您的回复将不胜感激.
解决方法 您可以使用 Solr Extracting Request Handler将Solr与HTML文件一起提供,并从HTML文件中提取内容.例如在 linkSolr使用Apache Tika从uploaded html file中提取内容
如果你想抓取网站并将其编入索引,Nutch与Solr是一个更广泛的解决方案.
Nutch with Solr Tutorial将帮助您入门.
以上是内存溢出为你收集整理的如何在SOLR中编制.html文件索引全部内容,希望文章能够帮你解决如何在SOLR中编制.html文件索引所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)