Page 5 of 5

Re: search module?

Posted: Thu Jul 14, 2005 11:26 pm
by fadum
Has anyone any news on a search module yet? just need this and my site is finished.

Thanks

Re: search module?

Posted: Wed Jul 20, 2005 2:51 am
by sagarkale
Hi took a crack on this.

I have uploaded a zip file to be dropped in /modules. path to this file is http://www.geocities.com/sagar_kale/Search.zip

Also needs a plugin file in the plugin directory

Code: Select all

function.search.php

Code: Select all

<?php
function smarty_CMS_function_search($params, &$smarty) {
	$domain = $_SERVER['SERVER_NAME'];
	$buttonText = 'Search Site';
	if (!empty($params['buttonText'])) 
		$buttonText = $params['buttonText'];

	return '<form method="get" action="index.php">
	<input type="hidden" name="page" value="searchResults">
	<input type="hidden" name="module" value="Search">
	<input type="hidden" name="template_demo" value="phpdig.html">
	<input type="hidden" name="refine" value="0">
	<input type="hidden" name="result_page" value="search.php">
	<input type="text" id="query_string" name="query_string" size="15" maxlength="50" alue="">
	<input type="submit" id="buttonSearch" value="'.$buttonText.'">
	</form>';

}

function smarty_CMS_help_function_search() {

}

function smarty_CMS_about_function_search() {
}

?>
Instruction:
  • Give full rights (777) to following directories
  • /modules/Search/text_content
  • /modules/Search/includes
  • /modules/Search/admin/temp
  • use chmod -R 777 or set to Read, Write, Execute in FTP application
  • open "/modules/Search/includes/config.php" & find "ABSOLUTE_SCRIPT_PATH" variable.  Update the path for current domain. For example replace "xxx.com" in "/home/httpd/vhosts/xxx.com/cms/modules/Search" to desired domain, say "linus.com.au".
  • Next step is to crawl the spider to search the keywords in the pages of the site. Navigate to http:///modules/Search/admin/ & login as with "admin:admin". Enter or link to indered the given text-area. Set Depth to 20 & Links to 0 & hit "Dig This".
  • Now add following tag to show the Search Box. This tag must be used with page to show Search Results.{search buttonText="Go"}
  • Add a page with desired template and add the code given below. Don't forget to  check OFF the checkbox "Show in menu".{CMS_module module="Search"}
Please check spellings if you get not found type of errors.

Let me know if it works somehow...

All the best.

Re: search module?

Posted: Thu Aug 11, 2005 7:52 am
by MadMcAl
I get an Error-Message when i try this search module:
Warning: Smarty error: unable to read resource: "db:searchResults" in /usr/export/www/vhosts/funnetwork/hosting/madmcal/cmsmadesimple/lib/smarty/Smarty.class.php on line 1088
I don't know what to do with this now.

This plugin works on newer webserver !!

Posted: Fri Aug 12, 2005 10:45 am
by piratos
Here is the code of my plugin, that works on newer versions of webserver but not on older php - versions.

Code: Select all

<?php

function smarty_cms_function_pisearch($params, &$smarty) {
                global $gCms;
                $config = $gCms->config;
		$db = $gCms->db;
                $result ="";
                $search="";
                if (isset($_GET["pisearch"])) $search = $_GET["pisearch"];
                if ($search)
                {
                 $search2=trim($search);
                 $search_ar=explode(" ",$search2);
                 $dbresult = $db->Execute("SELECT * FROM `".cms_db_prefix()."content` WHERE active = '1' AND type ='content' ORDER BY hierarchy");
                 if ($dbresult)
                 {
                  $first=true;
                  foreach ($dbresult as $row)
                  {
                   reset($search_ar);
                   $current=current($search_ar);
                   $w=false;
                   if ($current<>false) $w=true;
                   $weiter=$current;
                   $dbr = $db->GetRow("SELECT * FROM ".cms_db_prefix()."content_props WHERE content_id='".$row['content_id']."'");
                   if ($dbr)
                   {
                     $text=strip_tags($dbr['content']);
                     $vowels = array(".", ",", ":", "(", ")", "[", "]", "=", ";", "?",'"',"/","#",'"',"§","$","€","!"," ");
                     $text = str_replace($vowels, " ", $text);
                   }
                   else
                   {
                     $w=false;
                   }

                   while ($w)
                   {
                    // use strpos with older php - versions. stripos searchs in a case-insensitive manner, strpos not
                    $pos=stripos($text,$weiter);
                    if ($pos)
                    {
                      if ($first)
                      {
                      $result .='<span class="pisearchresult">Die Suchbegriffe wurden in folgenden Seiten gefunden: -> Suchworte ('.$search.') :</span><br />';
                      $first=false;
                      }
                      $result .='<span class="pisearch"><a class="pisearchlink" href="'.$config['root_url'].'/index.php?'.$config["query_var"]."=".$row['content_id'].'">'.$row['menu_text'].'</a></span><br />';
                      $w=false;
                    }
                    else
                    {
                     $weiter=next($search_ar);
                     if ($weiter<>false) {$w=true;}else{$w=false;}
                    } // if pos
                   } // while
                  } //foreach
                 } // if dbresult
                } // if search

               return $result;
}

function smarty_cms_help_function_pisearch() {
  ?>
	<p>You must set the plugintag in the template</p>
	<p>Create an inputformular to get the word to search in the template. </p>
	<p>
	Change History:<br/>
	None
	</p>
	<?php
}

function smarty_cms_about_function_pisearch() {
	?>
	<p>Author: Jan Czarnowski (Piratos) piratos@coftware.de</p>
	<p>Version: 1.0</p>
	<p>
	Change History:<br/>
	None
	</p>
	<?php
}

?>
You must set the plugin in a template  {pisearch} and the form too.

Here the example of the form:

Code: Select all

<form action="http://localhost/beta4/index.php" method="get"> <input type="text" value="" maxlength="50" size="15" name="pisearch" id="query_string" /> <input type="submit" value="Suchen" id="buttonSearch" /> </form>
This plugin searches only the contents and it works on newer webservers.

my testsite has old php - versions and  so it not works there good.

Change the text to your language and test it.

Re: search module?

Posted: Fri Aug 12, 2005 1:31 pm
by piratos
i have changed something in my script and now it works on my testsite.

you can see  it in action on my testsitehttp://piratos.coftware.de.

downloadoffer in some days.

DOWNLOAD NOW LOOK HEREhttp://forum.cmsmadesimple.org/index.php/topic,1414.0.html

Re: search module?

Posted: Wed Oct 26, 2005 11:16 am
by Piratos

Re: search module?

Posted: Wed Oct 26, 2005 2:48 pm
by alby

Re: search module?

Posted: Fri Oct 28, 2005 8:13 am
by Piratos
Thanks al !

Re: search module?

Posted: Sat Oct 29, 2005 5:44 pm
by Hans
100rk wrote: It seems like everybody likes MySQL fulltext search - I am sorry, I don't. ;-)

I agree, there is some limits for search systems like PhpDig, Isearch etc (safe mode, time limit...), but there are also 'Made Simple' (lightweight) search systems under GPL licence - for example this one: http://www.cs.ioc.ee/~ando/sphider/. It could not be so hard create module 'around' this product - for person with little bit 'free' time, of course.
I had a look and I must say that I'm very impressed about Sphider. Especially the possibilty to keep pages from being indexed (robot.txt, rel="nofollow" attribute in tags and even parts of pages (although that would require some coding by hand) and the output (with a part of the context around the searched word), makes this lightweight script a good solution IMHO.

It would be great if someone could a module out of it!!
Hans

Re: search module?

Posted: Tue Apr 03, 2007 8:08 am
by lupker
Hi folks,

I am also looking for a flexible search module for the cmsms.

I am not a PHP programmer, but I know the problem with the existing search modules lays with the fact, that they are not very flexible. Since the tables are included in the code itself. Using the CMSMS myself, I keep on adding new modules, which makes the search being outdated all the time.

Isn't it possible to do a keyword search through the whole database and then filter out the results?
For example add a config file which makes it possible to add MySQL-tables which should be searched. Also adding a catagory (which is the module name or the menu-item in the website) in a final filter would do the trick.

Anyone ideas how to proceed?

Greetz,
Mark