Here's the mostly working skeleton of the new advanced search function. Searching the entire site will look in all comment pages (but right now searching a particular page will not.) Of course searching the entire site is sloooooow. I'll be adding a toggle for case sensitive/insensitive, although you could get the same result using a regex if you know how to do [Tt][Hh][Aa][Tt].
jim i have to put the order in by 1:45 i cant send one case i can send 2cs at say $125 ($15 retail) or $160= $20retail advise asap
You can now choose whether to search in comments for a page or not (although searching the entire site will always look in comments still.) There is also a toggle for case sensitive/insensitive. What a pain that was. There must be an easier way than how I did it, but since I don't know I did it the hard way: find the length of the string; set up a for loop to recurse over the string (where the number of loops equals the length of the string); try to turn each character into its uppercase equivalent (and if this produces an identical character turn it into the lower case equivalent instead); piece the new string together with each character duplicated with it's opposite case inside of brackets; do the mysql select on the database where the post rlike '.*[Tt][Hh][Ee] [Ww][Oo][Rr][Dd].*';
Of course this would be much easier if I had just stored the information in a case insensitive way to start with (if I had made the post field 'text' instead of a 'blob') but then it would be impossible to do a case sensitive search. So it's a pain, but I wouldn't want it to not be a blob. Possibly there is some switch in mysql I could throw in to force a case insensitive search, but I couldn't find it in the docs anywhere.
The slow technique described above (that weird stuff after the 'rlike') makes use of regular expressions. You can also use regular expressions in your searches. You can learn more about this powerful tool here.
I love your comments.
One potentially cool thing with the search (now that you can constrain the results to a particular poster) is that searching for nothing returns every entry. At first I thought this was a bug and I was going to fix it, but if you search for nothing on a group page and constrain to a certain poster, you'll get all the posts by that person. So, this version of the /treehouse is sort of like linda's page.
Still, I probably need some checks in there because searching for nothing by anybody on every page would not only be slow for the person doing the search, but would probably slow down the whole server. I'll have to think more about what is an unacceptably broad search.
Whoops. That exposes a screw up. Mike used to have the user id number that linda now has. So some of Mike's early posts to /treehouse are returned on the search for linda's posts. I guess I mixed some of the uid's up the last time we changed over the system. I'll have to think of how to fix that. Can I just go in a change all the old ones, or will that screw something up....
|
- jim 11-01-2001 8:52 pm
jim i have to put the order in by 1:45
i cant send one case
i can send 2cs at say $125 ($15 retail)
or $160= $20retail
advise asap
- Skinny 11-02-2001 1:34 am
You can now choose whether to search in comments for a page or not (although searching the entire site will always look in comments still.) There is also a toggle for case sensitive/insensitive. What a pain that was. There must be an easier way than how I did it, but since I don't know I did it the hard way: find the length of the string; set up a for loop to recurse over the string (where the number of loops equals the length of the string); try to turn each character into its uppercase equivalent (and if this produces an identical character turn it into the lower case equivalent instead); piece the new string together with each character duplicated with it's opposite case inside of brackets; do the mysql select on the database where the post rlike '.*[Tt][Hh][Ee] [Ww][Oo][Rr][Dd].*';
Of course this would be much easier if I had just stored the information in a case insensitive way to start with (if I had made the post field 'text' instead of a 'blob') but then it would be impossible to do a case sensitive search. So it's a pain, but I wouldn't want it to not be a blob. Possibly there is some switch in mysql I could throw in to force a case insensitive search, but I couldn't find it in the docs anywhere.
The slow technique described above (that weird stuff after the 'rlike') makes use of regular expressions. You can also use regular expressions in your searches. You can learn more about this powerful tool here.
- jim 11-02-2001 4:09 pm
I love your comments.
- jim 11-02-2001 4:38 pm
One potentially cool thing with the search (now that you can constrain the results to a particular poster) is that searching for nothing returns every entry. At first I thought this was a bug and I was going to fix it, but if you search for nothing on a group page and constrain to a certain poster, you'll get all the posts by that person. So, this version of the /treehouse is sort of like linda's page.
Still, I probably need some checks in there because searching for nothing by anybody on every page would not only be slow for the person doing the search, but would probably slow down the whole server. I'll have to think more about what is an unacceptably broad search.
- jim 11-07-2001 5:53 pm
Whoops. That exposes a screw up. Mike used to have the user id number that linda now has. So some of Mike's early posts to /treehouse are returned on the search for linda's posts. I guess I mixed some of the uid's up the last time we changed over the system. I'll have to think of how to fix that. Can I just go in a change all the old ones, or will that screw something up....
- jim 11-07-2001 9:00 pm