Learn Japanese with JapanesePod101.com

View topic - search feature result display

search feature result display

Spotted any errors or found anything that doesn't work?

search feature result display

Postby Dehitay » Wed 05.30.2007 5:41 pm

I was using the Search option a while ago and I noticed that it was only giving me a few results per page. The first one was 3 results, the 2nd page was 1 result, and the 3rd page was actually 0 results. I'm not sure what happened. If I had to guess maybe it's giving pages by results that turned up on a particular day. But I would appreciate it if you could get it back to returning about 20 results per page or whatever it used to be
www.bananamonkeyninja.com
The only webcomic endorsed by Banana Monkey Ninja
User avatar
Dehitay
 
Posts: 1010
Joined: Fri 09.08.2006 8:36 pm
Location: San Antonio, Texas, USA
Native language: English
Gender: Male

RE: search feature result display

Postby zengargoyle » Wed 05.30.2007 6:06 pm

i've noticed this before, and i tracked it down once, but i've forgotten the exact reason why it's all messed up. the Search page is ~400 lines of the most horrid PHP code in existence... they will do a Database Query, and if there are no results they return a 'not found' message, if there are results, they do the same Database Query again! and show a page worth of results. there is a different section of PHP code for each of the search options, and i forget which one was totally broken.

if you can narrow it down to a test case, i might be able to fix it, or it might be broken beyond belief. :)

i've been working on adding a Google Search This Site function, but there are a couple of problems because TJP uses SJIS encoding instead of UTF-8 encoding...

anyway, the search page is full of particularly bad code...
User avatar
zengargoyle
 
Posts: 1200
Joined: Sun 05.29.2005 10:16 pm

RE: search feature result display

Postby Dehitay » Thu 05.31.2007 10:28 am

I was trying to search for とも in via forum posts and subject. I tried it again just now and for subject it gave me 4 pages displaying 0, 1, 1, and 1 results. For forum post, it gave me more pages than I tried counting and the first 4 pages had 1, 2, 1, and 2 results. Also, I remember it being a different pattern of results when I searched yesterday so it might change the pattern at certain times. One hypothesis that pops into mind may be the code used for the Recent Posts section changed something unintentionally, but that's just random speculation based on not having any problems before that.
www.bananamonkeyninja.com
The only webcomic endorsed by Banana Monkey Ninja
User avatar
Dehitay
 
Posts: 1010
Joined: Fri 09.08.2006 8:36 pm
Location: San Antonio, Texas, USA
Native language: English
Gender: Male

RE: search feature result display

Postby zengargoyle » Thu 05.31.2007 11:08 am

nah, it's just another case of PHP-Fusion vs. SJIS encoding. if searching for kana or kanji actually works, it's just random luck.

first the Subject column in the Database is going to be searched for %'0x82c682e0'% and since the database has no concept of muli-byte characters it may match one byte from the end of one character and another from the beginning of the following character. you may get lucky, you may not.

then, even if the database query returns results, PHP-Fusion doesn't really know about multi-byte encodings either. there is code in the search page to 'lowercase' the search string and count the number of matches (so it can put up a little "3 Matches" type of message). well, when you take a multi-byte character and treat it like plain ASCII and lowercase it... well, you're screwed.

so, the search page is hit or miss when dealing with kana/kanji. if it works at all, you got lucky.
User avatar
zengargoyle
 
Posts: 1200
Joined: Sun 05.29.2005 10:16 pm


Return to Problems

Who is online

Users browsing this forum: No registered users and 1 guest