<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Best way to search thread metadata?</title>
        <description> Hello, I&amp;#039;m writing a tagging module to allow users to tag threads with a simple array of strings.  I&amp;#039;m using v5.2

The way I&amp;#039;ve done this in other modules is to store the array in the first post&amp;#039;s metadata (parent_id = 0).  Easy enough.

But, the challenge here is how to filter the thread list by those meta tags.  I think I have two options:

1. Add tag support to search.php
2. Filter the topc list via list.php

Option #1 - Adding a new parameter to the search is easy enough, and there is already a hook &amp;quot;search_action&amp;quot; that allows a module to bypass the built-in phorum_db_search().  However, that would require writing a new phorum_db_search() as the existing DB layer functions don&amp;#039;t have hooks.  I don&amp;#039;t need to combine tag search with the other search params, so that makes it fairly easy.  However, I would have to somehow parse/search the &amp;quot;meta&amp;quot; column within the search SQL itself - very hacky/fragile

Option #2 - Modify the thread list to filter by tag(s).  Looking at list.php, there doesn&amp;#039;t seem to be a standard hook to bypass the built-in phorum_db_get_thread_list() - but it would be easy enough to add a new phorum_hook call.   But, then I&amp;#039;m in the same position of writing a new phorum_db_get_thread_list() to SQL search the serialized meta data just like before.

Any tips or tricks or hints or thoughts on this?  Do any other modules implement SQL meta data search that I can look at?

Thanks,
Skye</description>
        <link>https://www.phorum.org/support/read.php?14,155667,155667#msg-155667</link>
        <lastBuildDate>Tue, 15 Sep 2026 10:31:06 -0500</lastBuildDate>
        <generator>Phorum 6.0.4</generator>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,162621#msg-162621</guid>
            <title>Re: Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,162621#msg-162621</link>
            <description><![CDATA[ This looks like exactly what I need. Are you still open to sharing your code for tagging? I&#039;m okay with it requiring some hacks to build it in. I&#039;d like to implement it on a buy/sell forum very similar to the way that you did.]]></description>
            <dc:creator>Simon King</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Sat, 16 Oct 2021 16:45:38 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,157058#msg-157058</guid>
            <title>Re: Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,157058#msg-157058</link>
            <description><![CDATA[ I have been trying to decide how to record metadata for a project I am working on.I had already decided to use a structure to keep my data together. I think the structure will work well for storing general and specific metadata.]]></description>
            <dc:creator>Orinic</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Wed, 20 Apr 2016 02:00:39 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,155683#msg-155683</guid>
            <title>Re: Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,155683#msg-155683</link>
            <description><![CDATA[ It&#039;s too bad all the paging URL generation in list.php doesn&#039;t include all the passed $PHORUM[&quot;args&quot;], I had to redo all the paging in my hook because there was no way to extend or override the default list url templates.  That&#039;s the only really messy part in the tags module....]]></description>
            <dc:creator>Skye N.</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Fri, 27 Feb 2015 13:16:31 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,155678#msg-155678</guid>
            <title>Re: Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,155678#msg-155678</link>
            <description><![CDATA[ OK, the module is done!  <br />
<br />
I ended up adding a new hook &quot;list_action&quot; in list.php, but that&#039;s the only modification I needed to the base code.<br />
<br />
You can check it out here, with the new topic list filter drop-down:  [<a href="http://www.triumphexp.com/phorum/list.php?5" target="_blank"  rel="nofollow">www.triumphexp.com</a>]<br />
<br />
I&#039;m going to run it on that site for a while to iron out any bugs, before trying it on a bigger site.<br />
<br />
If there&#039;s any interest, I could package it up and make the code public.  But it does require some coding skills to install the new hook and quite a lot of template elements, and I don&#039;t have any time to provide support for the module.<br />
<br />
Skye]]></description>
            <dc:creator>Skye N.</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Thu, 26 Feb 2015 17:56:48 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,155669#msg-155669</guid>
            <title>Re: Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,155669#msg-155669</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Skye N.</strong><br />
I guess in the end, there is no good way to search the meta column so it&#039;s a non starter. The performance would be terrible and error prone<br />
<br />
[<a href="http://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad" target="_blank"  rel="nofollow">stackoverflow.com</a>]<br />
<br />
So, I should just normalize the db and create a separate thread_id -&gt; tag table from the start.</div></blockquote>
<br />
I was about to answer exactly that. The metadata is not really searchable, you should store it in a better searchable format.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Sun, 22 Feb 2015 03:41:16 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,155668#msg-155668</guid>
            <title>Re: Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,155668#msg-155668</link>
            <description><![CDATA[ I guess in the end, there is no good way to search the meta column so it&#039;s a non starter. The performance would be terrible and error prone<br />
<br />
[<a href="http://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad" target="_blank"  rel="nofollow">stackoverflow.com</a>]<br />
<br />
So, I should just normalize the db and create a separate thread_id -&gt; tag table from the start.]]></description>
            <dc:creator>Skye N.</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Sat, 21 Feb 2015 23:18:23 -0600</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?14,155667,155667#msg-155667</guid>
            <title>Best way to search thread metadata?</title>
            <link>https://www.phorum.org/support/read.php?14,155667,155667#msg-155667</link>
            <description><![CDATA[ Hello, I&#039;m writing a tagging module to allow users to tag threads with a simple array of strings.  I&#039;m using v5.2<br />
<br />
The way I&#039;ve done this in other modules is to store the array in the first post&#039;s metadata (parent_id = 0).  Easy enough.<br />
<br />
But, the challenge here is how to filter the thread list by those meta tags.  I think I have two options:<br />
<br />
1. Add tag support to search.php<br />
2. Filter the topc list via list.php<br />
<br />
Option #1 - Adding a new parameter to the search is easy enough, and there is already a hook &quot;search_action&quot; that allows a module to bypass the built-in phorum_db_search().  However, that would require writing a new phorum_db_search() as the existing DB layer functions don&#039;t have hooks.  I don&#039;t need to combine tag search with the other search params, so that makes it fairly easy.  However, I would have to somehow parse/search the &quot;meta&quot; column within the search SQL itself - very hacky/fragile<br />
<br />
Option #2 - Modify the thread list to filter by tag(s).  Looking at list.php, there doesn&#039;t seem to be a standard hook to bypass the built-in phorum_db_get_thread_list() - but it would be easy enough to add a new phorum_hook call.   But, then I&#039;m in the same position of writing a new phorum_db_get_thread_list() to SQL search the serialized meta data just like before.<br />
<br />
Any tips or tricks or hints or thoughts on this?  Do any other modules implement SQL meta data search that I can look at?<br />
<br />
Thanks,<br />
Skye]]></description>
            <dc:creator>Skye N.</dc:creator>
            <category>Phorum Development</category>
            <pubDate>Sat, 21 Feb 2015 21:00:10 -0600</pubDate>
        </item>
    </channel>
</rss>
