sylvester
sylvester

Reputation: 887

How can I create an index file in java?

I want to create an index file from a very large text file in java. Actually I want to keep the number and the byte of the first character in each line in the index file.I am going to use it to do searching as fast as possible in my original file.

It will be great if someone can help me with a sample code.

Upvotes: 0

Views: 3682

Answers (2)

Thomas Jung
Thomas Jung

Reputation: 33092

An index file is just a mapping Word -> Location. For simple problems you can build that on your own using a Multimap from the word to the locations of the word in the file.

If you need stop lists, stemming and other language processing, pre-, post-, or infix-search you should consider a search engine.

Upvotes: 0

adarshr
adarshr

Reputation: 62573

Have you checked Apache Lucene?

Upvotes: 4

Related Questions