|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
« Creating a Search Application » feedback
Hello,
After I posted about « Search for XML tutorials : Sorry, no results found », I thought I should take some time to read Matt's tutorial about « Creating a Search Application ». So here are some thoughts, remarks, suggestions, comments... about that tutorial. I hope it will help you to improve your already great writing skills, maybe you will even take some time to update or improve it - I reported a SQL syntax error about the « introduction » table SQL. - I think you could have shortened that tutorial by pointing the readers to other good tutorials about OOP and database design. However I think these little introductions were interesting. It's not that easy to « link » tutorials with each other... - For my own writing I use « styles », I think that tutorial could really use them. I write my documents with OpenOffice.org and I have styles for everything : PHP function names, PHP argument or variable names, database, UI, ... This can be easily done in PHP by using « BBCode » like tags. You would get something like : « The [span class='PHP_function']similar_text[/span] function calculates the similarity between two strings... » instead of « The similar_text() function... ». The document uses a CSS so you can change the typo, color, everything... Using a PHP script, you can get even transform (XLT ?) the tag contents to a link that directly point to... php.net - I think you should specify field names on INSERT. I'm not sure if you omit them to optimize the query but for a beginner it's then easy to make mistakes. I did - As an anti-echo guy I thought we could also use the <?= ?> tag to embed PHP into HTML. Specially in your « introduction » example. It avoids using n, quoting strings, escaping... It's even faster (PEAR::Benchmark inside :p). - We don't really know in which files a script is made to be. What's the file name for the DB_Class class ? You only guess it in the end... To help us I think you should provide the readers with a working example, online and an archive that contains the scripts and SQL structures as .sql files. - « If a word is found multiple times on a single URL, we will store it multiple times. ». You could also use a table that stores keyword ids. It would avoid storing a keyword multiple times, only its id is stored multiple times. Not sure it's the fastest way as it's an other step into the DB normalization realm - « By naming your class members appropriately, you create self documenting code. ». I like that one - « words that should not be included in the index, and words that should always be included in the index. »... Hum hum... What bothered me most in the tutorial was the use of arrays... I always try to focus on genericity and IMHO both using arrays and tables is not « the way ». That's why I only use... tables. Here I would convert these arrays to tables. Because when it comes to query, access, specially alter a database, PHP arrays don't take a chance. However as these routines are not « dynamically » on user's searches, it doesn't really matter. I'm just not into array :p. But I use to be - The « _getData » function can only handle files smaller that 25,000 bytes. A solution would be to get the URL contents using the « file » function or using the PEAR::File package. - I also missed « testing » the whole tutorial ride. We never really know if what we're reading or trying to understand actually work. We could use online tests for example. - Not sure it's a bug but I think you forgot to check if the « _searchterms » array is empty or not. Sometimes you access its first value (0) without checking. An other trick, you can use a single line to build your query instead of building a query before the « for » loop. The trick is to use a greedy « if » statement in the « for » and checking if the index is 0 or not. I know you will check (n - times) useless times if the index is equal to zero... But I can remember dozens of times bugging in the loop when the line before wasn't updated... - « doFuzzy ». That's the one I was waiting for - « SELECT DISTINCT(keyword) FROM keywords WHERE $match », I think the previous trick I introduced a few lines before would soften the query. You wouldn't need the « DISTINCT » option anymore. Well I could also point out how interesting the tutorial is or how well some concepts or ideas are introduced but I'm sure you hate compliments So keep up the good work with the Codewalkers team, I hope I will find some time to read some other tutorials. But don't worry if you get bored with that whole post, next time I won't post any feedback JM known as the « kitty » box. |
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > « Creating a Search Application » feedback |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|