On 8 Nov, [EMAIL PROTECTED] wrote:
> The midgard sites uses htdig for searching, but it would indeed be
> useful to be able to search the content (topics, articles and pages)
> from the code.
We had native searching back in Midgard 0.1, but Jukka
decided to drop it when he was cleaning Midgard up for the
first public release. That was also the time when the
original ACL implementation was dropped.
The way those features were implemented in early versions
of Midgard would've caused even more MySQL dependency
issues than we have now.
However, I've spoken about this with Jukka and we will
hopefully see a new implementation of searching with
Midgard again somewhere in the 2.x tree. This one should
also be done in more ODBC-usable fashion.
Here is an example how the old search system was
used...
(I'm just pasting this from Grey Wolves' site, there
is much more code on the page but I think the relevant
parts are here. The text is in Finnish, sorry.)
Search form:
<form method="get" action="/palvelu/haku/tarkka.html">
<table border="0">
<tr><td>Avainsanat:</td>
<td><input name="search" value="&(search);" size="30"></td></tr>
<tr><td>Fraasi:</td>
<td><input name="phrase" value="&(phrase);" size="30"></td></tr>
<tr><td>Hakualue:</td>
<td>
<select name="area">
<option value="59"<? if ($area == 54) {?> selected<? } ?>>Kaikki</option>
<option value="12"<? if ($area == 12) {?> selected<? } ?>>Uutiset</option>
<option value="74"<? if ($area == 74) {?> selected<? } ?>>Artikkelit</option>
<option value="62"<? if ($area == 62) {?> selected<? } ?>>Kuva-arkisto</option>
<option value="54"<? if ($area == 54) {?> selected<? }
?>>Tapahtumakalenteri</option>
</select>
</td></tr>
<tr><td>Tekij�:</td>
<td><?select_person("author", $author);?></td></tr>
<tr><td><input type="hidden" name="searchtype" value="2"></td>
<td><input type="submit" name="hae" value="Hae"></td></tr>
</table>
</form>
Doing the search:
<? if ($search || $phrase || $author)
$results = search_advanced_topic_articles_all($area, $search, $phrase,
$author);
else { ?>
<? if ($search)
$results = search_topic_articles_all($area, $search);
else { ?>
Displaying results:
<? if ($results) { ?>
<? if ($results->N > 0) { ?>
<p>Hakutuloksia &(results.N); kappaletta. Uusimmat ensin.</p>
<? } else { ?>
<p>Hakua vastaavia dokumentteja ei l�ytynyt</p>
<? } ?>
<? if ($results) while ($results->fetch()) {
if (is_in_topic_tree(12, $results->topic)) { ?>
<p><strong><a href="/uutiset/&(results.id:u);.html">&(results.title);</a></strong>
(uutinen)<br>
&(results.abstract);<br>
- L�hetetty &(results.date);, &(results.authorname);</p>
<? } elseif (is_in_topic_tree(74, $results->topic)) { ?>
<p><strong><a href="/artikkelit/&(results.id:u);.html">&(results.title);</a></strong>
(artikkeli)<br>
&(results.abstract);</p>
<? } elseif (is_in_topic_tree(62, $results->topic)) { ?>
<table border="0" width="100%">
<tr valign="top">
<td width="100%"><p><strong><a
href="/kuvat/&(results.id:u);.html">&(results.title);</a></strong> (kuva)<br>
&(results.abstract);</p></td>
<td><a href="/kuvat/&(results.id:u);.html"><?html_image($results->icon,
"align=left border=5");?></a></td>
</tr>
</table>
<? } elseif (is_in_topic_tree(54, $results->topic)) { ?>
<p>&(results.calendar);<br>
<strong><a href="/kalenteri/&(results.id:u);.html">&(results.title);</a></strong>
(tapahtuma)<br>
&(results.abstract);</p>
<? }
}
} ?>
> Emile
/Bergie
--
-- Henri Bergius -- +358 40 525 1334 -- [EMAIL PROTECTED] --
http://www.iki.fi/Henri.Bergius
--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org
To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]