Forum Moderators: coopster

Message Too Old, No Replies

implementing search within files with good performance

         

darkage

9:06 pm on Mar 2, 2007 (gmt 0)

10+ Year Member



Ive got 50-200 files with a total size of 3-10 MB which i need to be able to search.

How would you suggest the search code to be implemented?

These are some of my thoughts:
1) Since PHP is stateless i cant "upload" the file content to memory and perform search on it. Because of this im forced to open/read the files for every search. The best i could do is upload it into the users session, but large sessions can give severe performance problems.

2) I will be using regular expression to search on the file content

3) I could merge all the files into a single file, saving on the open/close routines, but it would be a headache when i have to display the search results and map them to the individual file

4) The file content is static, they will never change. Maybe this can be used to my advantage?

5) Google/MSN/Yahoo has not indexed the content good enough for them to be used.

Looking forward to hearing your ideas.

cameraman

1:22 am on Mar 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could upload them into a database, one row per file, then use full text search. Leave the files on the hard drive for SE to find, either serve them from the drive or from the db (use another field in the db table for the path to serve).