如何在SOLR中编制.html文件索引
发布时间:2020-12-14 23:21:46 所属栏目:资源 来源:网络整理
导读:我想要做索引的文件存储在服务器上(我不需要抓取). /路径/到/文件/ 示例 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" conte
我想要做索引的文件存储在服务器上(我不需要抓取). /路径/到/文件/
示例 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 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> 我在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> 我的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文件中提取内容.例如在
link
Solr使用Apache Tika从uploaded html file中提取内容 如果你想抓取网站并将其编入索引,Nutch与Solr是一个更广泛的解决方案. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- html – 删除悬停提示Visual Studio代码
- domain-name-system – DNS服务器和负载均衡
- HTML – 在td标签上显示背景图像
- .net – 如何以编程方式检查Web服务器是否启用了http压缩?
- html – CSS3 – 3D立方体 – IE变换风格:保留-3d解决
- defer属性导致引用JQuery的页面报“浏览器无法打开网站xxx,
- html – bootstrap col-md-12与宽度100%在显示/隐藏div时表
- html – CSS flexbox最大列号?
- 实现微信小程序的wxml文件和wxss文件在webstrom的支持
- jquery带有索引按钮且自动轮播切换特效代码分享