Is there a HTML analyzer/tokenizer for Lucene?

2019-03-13 07:59发布

I wanted to index text from html, in Lucene, what is the best way to achieve this ?
Is there any good Contrib module that can do this in Lucene ?

EDIT
Finally ended up using Jericho Parser. It doesn't create DOM and is easy to use.

标签: lucene
3条回答
看我几分像从前
2楼-- · 2019-03-13 08:09

I would recommend using Jsoup HTML parser to extract the text and then use Lucene. It worked well for me.

查看更多
【Aperson】
3楼-- · 2019-03-13 08:11

You might also want to take a look at /Lucene-3.0.3/src/demo which has an HTML parser example.

查看更多
Explosion°爆炸
4楼-- · 2019-03-13 08:17

I'm assuming that you don't actually want to index the HTML tags. If that's the case, you can first extract text from HTML using Apache Tika. Then you can index the text in Lucene.

查看更多
登录 后发表回答