|
|
| Problems? Is your data what you think it is? | |
| PerlMonks |
Poor Person's Databaseby Cody Pendant (Prior) |
| on Jun 20, 2001 at 04:57 UTC ( [id://89917]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a small search engine in a Perl environment where I can't use databases, it has to be flat files.
The search engine structure I've come up with involves an index with a word,documentnumber,documentnumber structure on every line, like so:
alpha,0,1,2 where the word "alpha" is in documents 0,1 and 2, the word "bravo" is in documents 2,3 and 4 and so on. So the structure as it stands requires me to open a 500kb file with hundreds of words/lines in it, and process every line to see if it starts with the search term(s). So it occured to me yesterday that it might actually be easier to have a structure where I actually had hundreds of files, where the keyword was the filename and the content was the list of documents, so rather than (pseudocode): I could just do something like: so am I crazy or what? I guess the factors are:
It's obviously a very messy solution, in that I'd have a folder stuffed with a large number of very small files, but in terms of doing less file-reading, less I/O, are there any gains?
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||