开发者

Indexing a document

If I'm looking to index a document (HTML) in java and the count the number of indexes, is Lucene the way to go? I have t开发者_JS百科he feeling that Lucene is just a search engine.

Many thanks indeed


Yes! I have done this exact thing. I used JSOUP and Lucene to fetch an HTML page to index the content. JSOUP is a similar library to jQuery except for java. So I was able to get the div I wanted to index and get all the text for that. I can share examples if you want. What is your doubt and maybe I can help you with that?

Edit: Here is an example of a project I did a while back https://github.com/amir20/iAuthor/blob/master/wikitool/src/main/java/edu/gwu/raminfar/iauthor/wikitool/WikiTool.java#L180

It works really well if you want a true indexing service. If you want to just store the HTML in a database then Lucene might not be your choice.


Well, yeah - Lucene is a search engine. (To be more precise: it's a library that allows you to build a search engine). To get a search engine, you need a text index, and Lucene provides that too. And it's a pretty powerful tool - it includes stemmers for English and a few other languages, and in my experience it runs fast even with large amounts of data.

Lucene won't parse the HTML for you, so you'll need to do that before putting the text into the index.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜