<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[PunBB Forums - limiting search results (biggest punbb problem for me)]]></title>
		<link>http://punbb.informer.com/forums/topic/21379/limiting-search-results-biggest-punbb-problem-for-me/</link>
		<description><![CDATA[The most recent posts in limiting search results (biggest punbb problem for me).]]></description>
		<lastBuildDate>Fri, 10 Apr 2009 12:53:23 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126688/#p126688</link>
			<description><![CDATA[<div class="quotebox"><cite>gorsan wrote:</cite><blockquote><p>i am being forced to convert smf now, which seems the correct way to go since i could not upgrade to punbb 1.3 because of utf8 problems which i cant really solve.</p></blockquote></div><p>Why? You haven&#039;t even added a limit to those two queries you posted above, so obviously they will return all matches.</p><p>That first query:</p><div class="codebox"><pre><code>                $result = $db-&gt;query(&#039;SELECT t.id FROM &#039;.$db-&gt;prefix.&#039;posts AS p INNER JOIN &#039;.$db-&gt;prefix.&#039;topics AS t ON t.id=p.topic_id INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=&#039;.$pun_user[&#039;g_id&#039;].&#039;) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN(&#039;.implode(&#039;,&#039;, $search_ids).&#039;)&#039;.$forum_sql.&#039; GROUP BY t.id&#039;, true) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());</code></pre></div><p>should be:</p><div class="codebox"><pre><code>                $result = $db-&gt;query(&#039;SELECT t.id FROM &#039;.$db-&gt;prefix.&#039;posts AS p INNER JOIN &#039;.$db-&gt;prefix.&#039;topics AS t ON t.id=p.topic_id INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=&#039;.$pun_user[&#039;g_id&#039;].&#039;) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN(&#039;.implode(&#039;,&#039;, $search_ids).&#039;)&#039;.$forum_sql.&#039; GROUP BY t.id LIMIT 50&#039;, true) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());</code></pre></div><p>Do the same for the second query.</p><br /><div class="quotebox"><blockquote><p>stats.punres will have a new number 1 forum soon.</p></blockquote></div><p>The point? This board isn&#039;t commercial, hence any responses are from people volunteering their time to responding. That approach is hardly liable to make people jump at your behest.</p>]]></description>
			<author><![CDATA[dummy@example.com (MattF)]]></author>
			<pubDate>Fri, 10 Apr 2009 12:53:23 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126688/#p126688</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126632/#p126632</link>
			<description><![CDATA[<p>@gorsan: Do you get an error when trying to upgrade to 1.3?<br />If so, Let me know what the error is and I will try and help you.</p>]]></description>
			<author><![CDATA[dummy@example.com (Smith)]]></author>
			<pubDate>Thu, 09 Apr 2009 20:22:18 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126632/#p126632</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126598/#p126598</link>
			<description><![CDATA[<p>i am being forced to convert smf now, which seems the correct way to go since i could not upgrade to punbb 1.3 because of utf8 problems which i cant really solve.</p><p>stats.punres will have a new number 1 forum soon.</p>]]></description>
			<author><![CDATA[dummy@example.com (gorsan)]]></author>
			<pubDate>Thu, 09 Apr 2009 11:18:48 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126598/#p126598</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126385/#p126385</link>
			<description><![CDATA[<p>could you please help me</p><p>my users are forcing me to open search.php again<br />it is impossible without limiting 2 million posts<br />i found i have to limit these querries and i found i have to do something like this link <br /><a href="http://lists.mysql.com/mysql/209407">http://lists.mysql.com/mysql/209407</a><br />example:<br /></p><div class="codebox"><pre><code>&gt;&gt; SELECT points
&gt;&gt; FROM results
&gt;&gt; WHERE
&gt;&gt; (
&gt;&gt;  SELECT count(*)
&gt;&gt;  FROM results as R
&gt;&gt;  WHERE R.person_id = results.person_id AND R.points &gt; results.points
&gt;&gt; ) &lt;3
&gt;&gt; ORDER BY person_id, points DESC</code></pre></div><p>but cant do it, the lines i have to change is below </p><div class="codebox"><pre><code>if ($show_as == &#039;topics&#039;)
            {
                $result = $db-&gt;query(&#039;SELECT t.id FROM &#039;.$db-&gt;prefix.&#039;posts AS p INNER JOIN &#039;.$db-&gt;prefix.&#039;topics AS t ON t.id=p.topic_id INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=&#039;.$pun_user[&#039;g_id&#039;].&#039;) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN(&#039;.implode(&#039;,&#039;, $search_ids).&#039;)&#039;.$forum_sql.&#039; GROUP BY t.id&#039;, true) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());

                $search_ids = array();
                while ($row = $db-&gt;fetch_row($result))
                    $search_ids[] = $row[0];

                $db-&gt;free_result($result);

                $num_hits = count($search_ids);
            }
            else
            {
                $result = $db-&gt;query(&#039;SELECT p.id FROM &#039;.$db-&gt;prefix.&#039;posts AS p INNER JOIN &#039;.$db-&gt;prefix.&#039;topics AS t ON t.id=p.topic_id INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=&#039;.$pun_user[&#039;g_id&#039;].&#039;) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN(&#039;.implode(&#039;,&#039;, $search_ids).&#039;)&#039;.$forum_sql, true) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());

                $search_ids = array();
                while ($row = $db-&gt;fetch_row($result))
                    $search_ids[] = $row[0];

                $db-&gt;free_result($result);

                $num_hits = count($search_ids);
            }</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (gorsan)]]></author>
			<pubDate>Fri, 03 Apr 2009 19:47:14 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126385/#p126385</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126089/#p126089</link>
			<description><![CDATA[<div class="codebox"><pre><code>if ($show_as == &#039;posts&#039;)
        {
            $substr_sql = ($db_type != &#039;sqlite&#039;) ? &#039;SUBSTRING&#039; : &#039;SUBSTR&#039;;
            $sql = &#039;SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, &#039;.$substr_sql.&#039;(p.message, 1, 1000) AS message, t.id AS tid, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id, t.labels FROM &#039;.$db-&gt;prefix.&#039;posts AS p INNER JOIN &#039;.$db-&gt;prefix.&#039;topics AS t ON t.id=p.topic_id WHERE p.id IN(&#039;.$search_results.&#039;) ORDER BY &#039;.$sort_by_sql.&#039;DESC LIMIT 50&#039;;
        }
        else
            //$sql = &#039;SELECT t.id AS tid, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM &#039;.$db-&gt;prefix.&#039;posts AS p INNER JOIN &#039;.$db-&gt;prefix.&#039;topics AS t ON t.id=p.topic_id WHERE t.id IN(&#039;.$search_results.&#039;) GROUP BY t.id, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id&#039;.$group_by_sql.&#039; ORDER BY &#039;.$sort_by_sql;
            $sql = &#039;SELECT t.id AS tid, t.poster, t.subject, t.question, t.sticky, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id, t.labels FROM &#039;.$db-&gt;prefix.&#039;topics AS t WHERE t.id IN(&#039;.$search_results.&#039;) ORDER BY &#039;.$sort_by_sql.&#039;DESC LIMIT 50&#039;;</code></pre></div><p>and then i had to delete this line <br />$sql .= &#039; &#039;.$sort_dir.&#039; LIMIT &#039;.$start_from.&#039;, &#039;.$per_page;</p><br /><p>well it did not optimize anything or searches i may be doing something wrong</p><p>thanks anyway.</p>]]></description>
			<author><![CDATA[dummy@example.com (gorsan)]]></author>
			<pubDate>Wed, 25 Mar 2009 01:52:36 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126089/#p126089</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126065/#p126065</link>
			<description><![CDATA[<p>Add Limit 50 to the end of the query where it retives the posts/topics.</p>]]></description>
			<author><![CDATA[dummy@example.com (Utchin)]]></author>
			<pubDate>Tue, 24 Mar 2009 19:05:39 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126065/#p126065</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126052/#p126052</link>
			<description><![CDATA[<p>thank you so much is there any solution for punbb 1.2 also ?</p>]]></description>
			<author><![CDATA[dummy@example.com (gorsan)]]></author>
			<pubDate>Tue, 24 Mar 2009 12:56:53 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126052/#p126052</guid>
		</item>
		<item>
			<title><![CDATA[Re: limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126045/#p126045</link>
			<description><![CDATA[<p>Go to &lt;FORUM_ROOT&gt;/inlcude/search_functions.php go to line 643 and replace this code<br /></p><div class="codebox"><pre><code>&#039;ORDER BY&#039;    =&gt; &#039;t.last_post DESC&#039;</code></pre></div><p>with this <br /></p><div class="codebox"><pre><code>&#039;ORDER BY&#039;  =&gt; &#039;t.last_post DESC&#039;,
&#039;LIMIT&#039;     =&gt; &#039;50&#039;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (Slavok)]]></author>
			<pubDate>Tue, 24 Mar 2009 09:29:33 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126045/#p126045</guid>
		</item>
		<item>
			<title><![CDATA[limiting search results (biggest punbb problem for me)]]></title>
			<link>http://punbb.informer.com/forums/post/126029/#p126029</link>
			<description><![CDATA[<p>is it possible to limit search results</p><p>go in this url and see <a href="http://mypunbb.com/search.php?action=show_unanswered">http://mypunbb.com/search.php?action=show_unanswered</a><br />it opens in 30 whole seconds</p><p>well in my own forum it is much worse</p><p>how can we limit search results for the first 50 topics for example</p><p>P.S. this is same in punbb 1.3 i should have posted this at bugs.</p><p>Anyone please help<br />thank you.</p>]]></description>
			<author><![CDATA[dummy@example.com (gorsan)]]></author>
			<pubDate>Mon, 23 Mar 2009 23:20:44 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/126029/#p126029</guid>
		</item>
	</channel>
</rss>
