• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search through files - API

 
ksp shenoy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to implement a search feature in one of my jsp application. Here, user inputs the search keyword and the application has search through all the files stored on the server and list out all the files containg the given keyword...So, is there any specific java API for this..? Or I need to read each and every file to look for the key word...in the second case, the process will take more time to perfom the search and seems to be less efficient...So, kindly help in this regards..

Regards
Pandurang
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you can invoke 'grep' from java, which is quite fast and handles some kind of regularexpressions.
grep is freely available for most unixes as far as I know and for windows too.
 
Joe Ess
Bartender
Posts: 9297
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's an implementation of grep in the New IO Examples. Should be reasonably fast. Perhaps you can bend it to your needs.
 
ksp shenoy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for the tips
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic