News:

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

Main Menu

New topic notifications

Started by The One, February 04, 2006, 10:54:14 AM

Previous topic - Next topic

The One

It would great to have a way to be notified of new posts (in any board even one where I have not enabled notifications) depending on the content posted.
For e.g. if someone posts a question that I am interested in, in a general board (where I would not have enabled notifications as I would get too many unrelated notifications), I would like still to be notified of this post based on the certain keywords I have specified.

I know this is probably something which is not doable at the moment (and arguably not feasible) but maybe sometime in future.
The problem is choice

Andreas4


Paracelsus

Maybe a combination of the Tag-MOD for topics and notification?

KGIII

This has been discussed (though not quite like this) in the past. The problem with this - I have looked - is resource usage. As near as I can tell ANYTHING that does this on an even remotely large scale will result in severe degradation of service and reliability at the server level regardless of the hardware it is housed on.

My PC Support Forum
Please ask in-thread before PMing
                   SMF Help
                   Visit My Blog

How can we improve the support process?:
http://www.simplemachines.org/community/index.php?topic=163533.0

SMF vs. Godzilla? Who do you think will win?

Andreas4

But on a limited scale for a few power users - admins, moderators, "experts"..?

KGIII

With each post that would require searching the database for the keywords, figuring out who subscribes to those words, and then processing the emails. I am not entirely sure how one would go about doing this but, even on a small scale, I would highly recommend against this.

My PC Support Forum
Please ask in-thread before PMing
                   SMF Help
                   Visit My Blog

How can we improve the support process?:
http://www.simplemachines.org/community/index.php?topic=163533.0

SMF vs. Godzilla? Who do you think will win?

Andreas4

You're right, we would need a table with user IDs and keywords, every time someone posts a new message it is matched against the keywords and if there is a match forwarded to the already existing "notification code", I have not digged any deeper into this but maybe it's enough to write an entry in the "smfsol_log_notify" table to trigger a notification.

This should be fairly easy to implement and very useful when moderating a large forum, OK we have the censor words table, but in many cases a word is OK in one context but not in another, this way I could decide myself when.

I would also be able to get notifications as soon someone writes a message with my name in it and respond.

Exactly why do you highly recommend against this?

Quote from: KGIII on March 20, 2007, 07:11:50 PM
With each post that would require searching the database for the keywords, figuring out who subscribes to those words, and then processing the emails. I am not entirely sure how one would go about doing this but, even on a small scale, I would highly recommend against this.

KGIII

Quote from: Andreas4 on March 21, 2007, 04:38:53 AM
Exactly why do you highly recommend against this?

From what I can see, the additional queries and then the additional actions will cause giant CPU spikes whenever someone posts a topic or reply.

My PC Support Forum
Please ask in-thread before PMing
                   SMF Help
                   Visit My Blog

How can we improve the support process?:
http://www.simplemachines.org/community/index.php?topic=163533.0

SMF vs. Godzilla? Who do you think will win?

Andreas4

Sorry, I don't follow, how can a couple of searches in a single posting cause giant CPU spikes?

(In relation to the normal SMF search function where the entire database is searched.)

Harro

Quote from: Andreas4 on March 22, 2007, 04:08:18 AM
Sorry, I don't follow, how can a couple of searches in a single posting cause giant CPU spikes?
Problem is that you don't have to search in that single post.
When a post  is made it has to query the entire users table to see which user has chosen those keywords, and then send a mail.
So when you have quit a lot members, it could slow down the forum.

Andreas4

Why query the entire users table? My thought is to create a new small table with users to get notifications.

Harro

A small example:

Post is created -> check first word of post -> check user 1 if he has chosen that keyword -> send mail if needed -> check user 2 if he has chosen that keyword -> send mail if needed -> ...
-> check second word of post -> check user 1 if he has chosen that keyword -> send mail if needed -> check user 2 if he has chosen that keyword -> send mail if needed -> ...
-> check word 3 from post -> ....

Even with a new table it would still require lots of queries.

Andreas4

Why lots of queries? Why not:

Query 1: get all keywords to search for and email addresses for notifications to PHP array.

In PHP: Loop array
Search entire post for word 1 in array->If match flag users that should be notified in array
Search entire post for word 2 in array->"
...

In PHP: Loop array again and send messages if needed.

One query in total.

Harro

Good point. Didn't think of it like that.
But it still has to check every user and every word in the post (ofcourse you can set some 'ignore words"), and it could take some time with a larger forum.

Andreas4

The entire post has to be searched for each word of course, but that is not a problem and it takes the same time regardless of how big the forum is.

I don't understand why every user should be checked when users that are to be notified are in the notification table. Consider this:

Notification table format:
column1 = word
column 2 = (list) e-mail address(es)
column 3 = (boolean) match

Example:
line1: word1; email1,email2
line2: word2; email2
line3: word3; email3
line4: word4; email2,email3
line4: word5; email4

The only thing that would really slow down things would be if there was a big notification table, but remember that this would be a feature for moderators and a few power users, so I really don't see any problem.

The One

Actually if there was someway we could defer the search and postpone it to a time when the server is relatively free that would be great too. Or maybe do this once a day.
We don't really need this to be real-time.
The problem is choice

Andreas4

#16
Good point! Once a night maybe.

Harro

Sounds good.
But then you also have to track if the member didn't already read the topic.

But if you limit it to a few users it could work

KGIII

You have me thinking... (Which is a bad idea...) When the post is made it could check the post and then automatically use the "report to moderator" function that is built in. This is my busy day/night and then tomorrow I head into my weekend travels but this will give me something to poke at - I will look around and see what I can come up with but I am still concerned that it may chomp some compute cycles. Anyhow, maybe doing a word check when it converts the BBCode and automatically converts URLs...

My PC Support Forum
Please ask in-thread before PMing
                   SMF Help
                   Visit My Blog

How can we improve the support process?:
http://www.simplemachines.org/community/index.php?topic=163533.0

SMF vs. Godzilla? Who do you think will win?

Andreas4

Did you have a look at this?

Advertisement: