News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How to force "search" inside BB tags?

Started by dand, September 06, 2011, 10:52:23 AM

Previous topic - Next topic

dand

Hi guys,
I am using a custom BB code [pgn]{game text}[/pgn] to add a chess game to the forum. I am using the pgn4web tool: http://code.google.com/p/pgn4web/wiki/User_Notes_simplemachines

When I use forum search to find a specific games, for example "Kasparov", it returns nothing. Could this be fixed somehow?

Thanks.



kat

It can't be fixed, as such, coz it's not broken.

Forum search does exactly that. Searches for text, on your forum.

Maybe you could use this:

http://custom.simplemachines.org/mods/index.php?mod=2566

to make searches of your forum, like this does?

http://www.google.co.uk/search?q=Kasparov+site%3Ahttp%3A%2F%2Fwww.simplemachines.org%2Fcommunity&hl=en&client=opera&rls=en&channel=suggest&num=10&lr=&ft=i&cr=&safe=off&tbs=

(Just thinking out-loud, here.)

dand


No, that doesn't help.  :(

Fix... I ment, could it be implemented, hacked somehow? To fool the search engine to go into BB tags? 


dand

No, that still doesn't search between [pgn] [/pgn] tags.

kat

Not a clue, then, I'm afraid.

Unless you can edit your .htaccess file to cope with this, somehow, I really have no ideas.

IchBin™

I think the problem is that it doesn't store the tag and what you put in it. BBC converts your tag into what the BBC Tag requires and then stores that information. No real way to make it search for your text if your text is converted into something else.
IchBin™        TinyPortal

MrPhil

BBCode is stored in the database "as is". If your post includes [pgn]{game text}[/pgn], that's all that's in the database, which is what Search is looking through. Not until the post is rendered for display does it get turned into the final text (including HTML). If your original post does not include the word "Kasparov" in the game text, there's no way for Search to see it. As far as I know, Search does look within (unexpanded) BBCode tags -- I've always been annoyed by its returning search results from within [code] tags. Has this behavior been recently changed? If your "game text" does include "Kasparov", could Search possibly be failing to pick it up because it's not cleanly separated from other text?

There was a mention of .htaccess -- are there any settings, such as in ModSecurity, that would affect what tags are excluded from searches?

IchBin™

Sorry I should have been more clear as I can see MrPhil pointed out that what I said wasn't true. I was referring to the search results where I thought the BBC is parsed and saved out into array. Of course it saves BBC directly to the database otherwise that would make all the security checks we have for this type of stuff in vein. lol
IchBin™        TinyPortal

dand

Hi guys, 
Thanks so much for the answers, there is hope for chess forum users. :-) 

Yes, the word "Kasparov" is within the tag. This is how it looks:

[pgn]
[White "Kasparov"]
[Black "Short"]
[Result "1-0"]
[Event "Paris Open"]
[Round "7"]
1. c4 e5 2. Nc3 Nc6 3. Nf3 Nf6 4. d3 Bc5 5. Bg5 O-O 6. e3 Be7 7. Be2 Re8 8. O-O a6 9. Qd2 d6 10. h3 Be6 11. e4 Qd7 12. Nd5 Nxd5 13. cxd5 Bxg5 14. Nxg5 Bxd5 15. exd5 Ne7 {1-0}
[/pgn]

Could you be a bit more precise with "htaccess" since I am not too familiar with such things?


IchBin™

IchBin™        TinyPortal

MrPhil

Does Search find text that is not within square brackets, such as "Nc3"? I don't think that Search excludes tags themselves (I just searched for pgn on this page), although [White] and [Black] may be valid BBCode tags themselves. If Kasparov isn't in "quotes" is it found? It seems to work on this page, too.

Are you on SMF 1.1.x or 2.0.x?

I can't imagine why mod security would flag "Kasparov" as a dangerous term...

IchBin™

Quote from: MrPhil on October 18, 2011, 12:45:29 PM

I can't imagine why mod security would flag "Kasparov" as a dangerous term...

I don't either, but I've had mod_security bite me with some very weird stuff before not allowing certain param names and even text in the request or resource.
IchBin™        TinyPortal

MrPhil

Mebbe "asp" within the name? That's all I can see... Hmm. How about a post that says "Cleopatra did herself in with an asp according to folklore"?  Or "I aspire to greatness." Or "My gate has a clasp on it." It would be interesting to see if any or all of those fail.

dand

I don't know how, but seems like it works now.  :o

Advertisement: