* Nick Jenkins nickpj@gmail.com [2006-08-08 17:27:12 +1000]:
I.e. the NULL character, and the LF / linefeed character.
No idea if that is something that could or should be fixed or not.
Strange, thank you for the report. I will have a look at this problem.
I think this may just be the socket timing out. For example, if I do "telnet localhost <whatever-port-tcpQuery-is-on>", then after 1 second it times out and closes the connection. So no idea if it's a real problem or not to ignore NULL character + LF / linefeed character in the input, but I think that's what it's doing, and then the socket times out.
In fact, this is the way I got the query from socket. I used a library that wait for some delimitors. And these two delimitors are not in the list, I put a timeout of 1s to do not freeze the connection since it is not a multi-threaded application. I don't think it is a problem, I can add 0 and 10 to the list of delimitors.
Also, I've made a few small changes to the web UI (extra directory), and the diff is at: http://files.nickj.org/MediaWiki/wikipedia-suggest-0.2-extra-diff.txt
It changes a few small things, namely:
- Added strict mode (for PHP5), changed from 'var' to 'private' to
keep PHP5 strict mode happy, and added quick accessor method for $res attribute.
- Remove leading "/" from paths for image directory and query.php.
This allows the web files to be placed in a subdirectory as well as the root directory, by using relative paths instead.
- When the user made a search (e.g. "fish"), then highlighted all
their search terms, then pressed delete (so that the search field was now blank), then pressed arrow up or arrow down, then it would show the old results (e.g. Fishing / FishBase / etc). To prevent this added an "if" clause to only show results when there is something in the query field.
- Added one JS var declaration for 'i' loop variable.
- Problem with quotes. For example, if I search for: "The devil", then
it returns many links, including "The Devil's Rejects", the "The Devil's Advocate (film)", and so forth. However when I search for "The devil's", then the results become empty, but we know from before that there are suitable matches. The reason is because the query string comes through as "The Devil's" (e.g. can see this at http://suggest.speedblue.org/query.php?query=The%20Devil%27s ), so one way to avoid this is just to use stripslashes in query.php, so I added this.
- I also tried experimenting with adding a "changeHighlight" function
and HTML IDs to each table row (to save redrawing the table when the user presses the up or down arrow keys), but it doesn't seem to make much difference either way (doesn't seem any slower or faster), so you might not want to use that.
Thank you for all these great changes, I will add them this evening on suggest.speedblue.org and put them in the tarball.
Best Regards. Julien Lemoine.