使用 Solr 索引带有属性的 HTML 标签 [英] Using Solr for indexing HTML tags with attributes
问题描述
我使用 Nutch 抓取了网站,并将抓取的数据推送到了 solr.现在我想在具有特定属性值的特定标签之间搜索内容.例如,
要搜索的标题</title></h><div id="abc">要搜索的内容
<div class="efg">要搜索的其他内容
我见过这个问题(如何使用 nutch 解析 html 并将特定标签索引到 solr?)但这不够清晰.
我想知道是否有任何可用的插件,或者我需要完全编写一个自定义插件.如果我必须编写一个插件,我只需要一些处理 html 标签和属性的说明.
你可以实现一个 Nutch 过滤器(我喜欢 Jericho HTML Parser) 以仅提取您需要使用 DOM 操作编制索引的页面部分.您可以使用 TextExtractor 类来抓取干净的文本(sans HTML 标签)用于您的索引.我通常将这些数据保存在自定义字段中.
I have crawled websites using Nutch and I have pushed crawled data to solr. Now I want to search content between specific tag with specific attribute value. For example,
<h><title> title to search </title></h>
<div id="abc">
content to search
</div>
<div class="efg">
other content to search
</div>
I have seen this question(how to parse html with nutch and index specific tag to solr?) but this does not have enough clarity.
I want to know that whether there is any plugin available or i need to write a customized plugin altogether. If i have to write a plugin, i just need few directions for handling html tags and attributes.
You can implement a Nutch filter (I like Jericho HTML Parser) to extract only the parts of the page you need to index using DOM manipulation. You can use the TextExtractor class to grab clean text (sans HTML tags) to be used in your index. I usually save that data in custom fields.
这篇关于使用 Solr 索引带有属性的 HTML 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!