Hash tag support

User avatar
Wodan
ISO Advocate

22 Nov 2016, 21:53

Did some more testing. Seems like the search has a degree of fuzzyness and will find matches without the hashtag as well. Clicking on #phpBB will pop up lots of phpbb URLs :)

Maybe it's possible to add a parameter to the search to only show exact matches

Rimrul

22 Nov 2016, 22:04

Ray wrote: actually doing your own tagging system and use the search-function for it isn't that easy in phpbb, because search replaces any non-alphanum with spaces (i.e. word seperator).

If this wasn't the case it would be easy (I guess) to do an autocorrection for anything starting e.g. with # with a link to searchresults for that tag.
Same problem Wodan. You can't search for any special characters.

User avatar
webwit
Wild Duck

22 Nov 2016, 22:04

Did some fixes with the German links I found at the last page of the mod for that. Re-creating the search index. This might take a while...

Rimrul

22 Nov 2016, 22:06

It seems that fix broke the hashtags. Might just be temporary, though.

User avatar
webwit
Wild Duck

22 Nov 2016, 22:06

Search index is about 10% filled now...217.3 posts per second.

User avatar
Ratfink

22 Nov 2016, 22:17

Okay, here's my proposal. Make the tags by writing a # before the word in your post as it currently works, but hide the # when actually displaying the post. That would fix my major complaint, which is that all those # characters are an eyesore.

Hell, if people actually want to see them, then do what I said above, but give the tag links a class like .hashtag, and add a CSS rule like:

Code: Select all

a.hashtag::before {
    content: "#";
}
Then I could remove them with a custom stylesheet, but everyone who isn't a crotchety young man can leave them in place.

Rimrul

22 Nov 2016, 22:30

It's starting to work again. The bad news is: It's working too good. It recognises # in code blocks. I'm not sure we want threads about firmware tagged with #ifdef and similar hashtags...

EDIT: Ratfinks suggestion could also cause issues with code or urls containing anchors.
Last edited by Rimrul on 22 Nov 2016, 22:33, edited 1 time in total.

User avatar
webwit
Wild Duck

22 Nov 2016, 22:31

Yeah I was afraid of that. I'm not sure that can be prevented. It's all or nothing. But feel free to submit patches to that mod to exclude code for example.

Rimrul

22 Nov 2016, 22:34

It also affects urls with anchors, i.e.
https://www.phpbb.com/community/viewtop ... #p13329580

User avatar
Ratfink

22 Nov 2016, 22:35

Rimrul wrote: It's starting to work again. The bad news is: It's working too good. It recognises # in code blocks. I'm not sure we want threads about firmware tagged with #ifdef and similar hashtags...

EDIT: Ratfinks suggestion could also cause issues with code or urls containing anchors.
Well, does the current situation change links that have anchors in them?
deskthority-f17/hash-tag-support-t15163-30.html#p340470
EDIT: it seems only long ones get messed with.
Does it mess with text in code tags?

Code: Select all

#ifndef TESTING_H
#define TESTING_H
...blah...
#endif
Oh geez, it does mess with code. That seems like it should be preventable to me.

User avatar
webwit
Wild Duck

22 Nov 2016, 22:37

The mod should take anchors and css colors into account.

Rimrul

22 Nov 2016, 22:38

The fix seems to only damage urls over a cetrain length.

User avatar
webwit
Wild Duck

22 Nov 2016, 22:41

I guess the bug in someone in here:

Code: Select all

$text= preg_replace_callback( '/(^|style="[^"#]+|[^\\s]*[\\s]+|>)#([\\p{Lu}\\p{Ll}\\p{N}\\w\\d]+)\\b/um', 'hashtag_callback', $text );
Lovely, lovely. Let's get to it, people! :twisted:

Edit: re-indexing has finished. Test: #phpBB

Rimrul

22 Nov 2016, 23:05

I think I figured out the part that damages the shortened links and shortened the match, but can't quite figure out how to exclude it from matches.

User avatar
webwit
Wild Duck

22 Nov 2016, 23:09

Rimrul wrote: It also affects urls with anchors, i.e.
https://www.phpbb.com/community/viewtop ... #p13329580
Fixed that, but not historically. I cheated by replacing # with ⌗ (viewdata square) in the url shortener code. But that is invoked upon save of a post, not render.

User avatar
Ratfink

22 Nov 2016, 23:15

webwit wrote:
Rimrul wrote: It also affects urls with anchors, i.e.
https://www.phpbb.com/community/viewtop ... #p13329580
Fixed that, but not historically. I cheated by replacing # with ⌗ (viewdata square) in the url shortener code. But that is invoked upon save of a post, not render.
Could you maybe just make the URL get shortened to something like this (no spaces around the ellipsis)? https://www.phpbb.com/community/viewtop…#p13329580

User avatar
webwit
Wild Duck

22 Nov 2016, 23:22


User avatar
Wodan
ISO Advocate

23 Nov 2016, 07:07

So that's how feature requests work here? ~12h to fulfill them?

Checked the tags and they work exactly as I hoped they would. How awesome is that...

User avatar
ohaimark
Kingpin

23 Nov 2016, 07:21

If only all websites were so efficient...

User avatar
kbdfr
The Tiproman

23 Nov 2016, 08:47

Ratfink wrote: Okay, here's my proposal. Make the tags by writing a # before the word in your post as it currently works, but hide the # when actually displaying the post. That would fix my major complaint, which is that all those # characters are an eyesore.

Hell, if people actually want to see them, then do what I said above, but give the tag links a class like .hashtag, and add a CSS rule like:
[…]
Then I could remove them with a custom stylesheet, but everyone who isn't a crotchety young man can leave them in place.
Image

User avatar
webwit
Wild Duck

23 Nov 2016, 11:11

Wodan wrote: ~12h to fulfill them?
~12h to 6y.

User avatar
webwit
Wild Duck

24 Nov 2016, 00:04

Ratfink wrote: but hide the # when actually displaying the post.
I see your point, but the # is also an indicator that it leads to a search of the keyword following it. Otherwise it could be any link. It's also now sort of a standard interface element to denote such links, so to change it to a grey link or something would not work either. It's all or nothing basically. If you or some other club member feels strongly about it, start a club vote, "hash tags, yes or no."

#complaintdepartment

User avatar
ohaimark
Kingpin

07 Dec 2016, 06:20

Is there any way to resolve numbers with the pound sign, such as #14, being transformed into searchable links?

Perhaps you could limit the feature to strings that have alphanumeric characters, not just numeric characters?

User avatar
webwit
Wild Duck

07 Dec 2016, 11:31

It would be possible, but someone would then complain their #1337 hashtag or whatever isn't working.

User avatar
ohaimark
Kingpin

07 Dec 2016, 11:52

I can't think of many useful hashtags that would have numbers only.

Maybe IBM Model numbers? Ah well.

User avatar
Khers

07 Dec 2016, 11:57

Would it be possible to require a minimum string length for all-number hashtags?

User avatar
kbdfr
The Tiproman

07 Dec 2016, 12:01

I would suggest assigning the hashtags a colour.
Or perhaps a pic.
Or music, why not?
:mrgreen:

User avatar
ohaimark
Kingpin

07 Dec 2016, 12:09

That's a better solution, Khers. I'd say a four digit minimum.

Post Reply

Return to “Deskthority talk”