downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

udm_add_search_limit> <usleep
[edit] Last updated: Mon, 01 Nov 2010

view this page in

LXXXIX. mnoGoSearch Funktionen

Diese Funktionen erlauben den Zugriff auf die mnoGoSearch (früher als UdmSearch bekannt) Suchmaschine. Um auf diese Funktionen zugreifen zu können, muss PHP mittels der --with-mnogosearch-Option mit mnoGoSearch-Unterstützung compiliert worden sein. Wird diese Option ohne Pfadangabe zu mnoGoSearch verwendet, wird mnoGoSearch in /usr/local/mnoGoSearch gesucht. Wurde mnoGoSearch unter einem anderen Pfad installiert, kann der Pfad mittels --with-mnogosearch=DIR spezifiziert werden.

mnoGoSearch ist eine vollwertige Suchmaschine für den Intra- und Interneteinsatz, vertrieben unter der GPL. mnoGoSearch hat einige einzigartige Funktionen, die es für weite Einsatzbereiche tauglich machen. Es bietet Volltextindizierung von HTML, PDF und Textdokumenten. mnoGoSearch besteht aus zwei Teilen: Der erste ist der sogenannte indexer, der den Indizierungsmechanismus bereitstellt. Er spidered HTTP, FTP und Newsserver oder lokale Dateisysteme, indiziert die gefundenen Dokumente und speichert Meta-Daten über die Dokumente in einer SQL-Datenbank.

Anmerkung: PHP beinhaltet zwar einen eingebauten MySQL-Support, dieser ist jedoch nicht mit mnoGoSearch kompatibel, deshalb muss PHP gegen die selben generischen MySQL-Bibliotheken wie mnoGoSearch gelinkt werden, also z.B.: --with-mnogosearch --with-mysql=/usr.

Es wird mindestens Version 3.1.10 von mnoGoSearch vorausgesetzt, um die folgenden Funktionen nutzen zu können.

Weitere Informationen über mnoGoSearch können unter » http://www.mnogosearch.org/ abgerufen werden.

Inhaltsverzeichnis

udm_add_search_limit — Verschiedene Beschränkungen bei der Suche anwenden
udm_alloc_agent_array — Allocate mnoGoSearch session
udm_alloc_agent — Allocate mnoGoSearch session
udm_api_version — Gibt die Version der mnoGoSearch API zurück.
udm_cat_list — Liefert alle Kategorien auf der selben Ebene wie der aktuellen zurück.
udm_cat_path — Liefert den Pfad zur aktuellen Kategorie zurück.
udm_check_charset — Überprüft, ob mnoGoSearch der übergebene Zeichensatz bekannt ist
udm_check_stored — Check connection to stored
udm_clear_search_limits — Löscht alle mnoGoSearch Suchrestriktionen
udm_close_stored — Open connection to stored
udm_crc32 — Gibt eine CRC32-Prüfsumme des übergebenen Strings zurück.
udm_errno — Liefert den mnoGoSearch Fehlercode zurück.
udm_error — Liefert eine mnoGoSearch Fehlermeldung zurück.
udm_find — Führe eine Suche durch.
udm_free_agent — Löscht eine mnoGoSearch Session
udm_free_ispell_data — Gibt den Speicher frei, der für ISpell alloziiert wurde.
udm_free_res — Löscht ein mnoGoSearch-Ergebis.
udm_get_doc_count — Liefert die Anzahl aller Dokumente in der Datenbank zurück.
udm_get_res_field — Erhalte ein mnoGoSearch Ergebenisfeld
udm_get_res_param — Liefert die mnoGoSearch Ergbnisparameter zurück.
udm_hash32 — Return Hash32 checksum of gived string
udm_load_ispell_data — Lade ISpell-Daten
udm_open_stored — Open connection to stored
udm_set_agent_param — Setzt die Parameter der aktuellen mnoGoSearch Session


udm_add_search_limit> <usleep
[edit] Last updated: Mon, 01 Nov 2010
 
add a note add a note User Contributed Notes mnoGoSearch Funktionen
mikko at sorl dot net 15-Oct-2006 04:46
Well since the function udm_get_res_param used with UDM_PARAM_NUM_ROWS does infact not get the number of rows on the current page, it can actualy find more rows than specified by UDM_PARAM_PAGE_SIZE, ??? well i had to rewrite the some stuff I also added highlightning since the parameter  UDM_PARAM_HLBEG nor UDM_PARAM_HLEND doesnt seem to work, alot of things here are fairly undocumented, I also found out after reading the Search_Mnogosearch pear class that replacing "\2" and "\3" in the text with HLBEG and HLEND works. well here is the class rewritten (without fetch, just find):

<?php

class MnogoSearch
{
    public   
$matches = NULL;
    public   
$total   = NULL;
    public   
$hilites = array('title', 'text');
    public   
$hlbeg   = '<span class="hilite">';
    public   
$hlend   = '</span>';

    protected
$agent   = NULL;
    protected
$res     = NULL;

    public function
__construct() {

       
$this->agent = udm_alloc_agent('mysql://user:pass@localhost/mnogosearch/');

       
$this->set(UDM_PARAM_SEARCH_MODE, UDM_MODE_ALL);
       
$this->set(UDM_PARAM_CHARSET, 'iso-8859-1');
       
$this->set(UDM_PARAM_BROWSER_CHARSET, 'iso-8859-1');
       
$this->set(UDM_PARAM_WORD_MATCH, UDM_MATCH_SUBSTR);

    }

    private function
hiLite($t) {
        if (
$t == '')
            return
'';
       
$t = str_replace("\2", $this->hlbeg, $t);
       
$t = str_replace("\3", $this->hlend, $t);
        return
$t;
    }

    public function
set($k, $v) {
       
udm_set_agent_param($this->agent, $k, $v);
    }

    public function
find($q, $page=0, $rows=10) {

        if (
$page < 0 || $rows <= 0) {
           
$page = 0;
           
$rows = 10;
        }

       
$this->set(UDM_PARAM_PAGE_SIZE, $rows);
       
$this->set(UDM_PARAM_PAGE_NUM, $page);

       
$this->res = udm_find($this->agent, $q);
       
$this->total = udm_get_res_param($this->res, UDM_PARAM_FOUND);

       
$found = udm_get_res_param($this->res, UDM_PARAM_NUM_ROWS);

        if(
$found) {
           
$b = udm_get_res_param($this->res, UDM_PARAM_FIRST_DOC);
           
$e = udm_get_res_param($this->res, UDM_PARAM_LAST_DOC);
           
$rows = $e - $b + 1;

           
$fields = array('urlid', 'url', 'content', 'title', 'keywords', 'desc',
                           
'text', 'size', 'rating', 'modified', 'order', 'crc', 'category',
                           
'lang', 'charset', 'siteid', 'pop_rank', 'originid');

            for(
$i=0; $i<$rows; $i++){
                for(
$j=0; $j<count($fields); $j++) {
                   
$this->matches[$i][$fields[$j]] = udm_get_res_field($this->res, $i, $j+1);
                }
                foreach(
$this->hilites as $hilite) {
                   
$this->matches[$i][$hilite] = $this->hiLite($this->matches[$i][$hilite]);
                }

            }
            return
$rows;

        } else {
            return
FALSE;
        }
    }

    public function
__destruct() {
       
udm_free_agent($this->agent);
        if (isset(
$this->res)) {
           
udm_free_res($this->res);
        }
    }
}

?>

Im thinking, maybe swish-e is better ? :)
bloodjazman at gmail dot com 22-Jun-2005 05:22
for win32 users, mnogosearch since version 3.2.x
support COM interface

for Reflection API of COM use Visual Studio .NET
-> Tools ..
-> OLE/COM object viewer
- > C:\Program Files\mnoGoSearch\searchcom.dll

simple code

<pre>
<?
define
('MNOGOSEARCH_WIN32',
    (
strtoupper(substr(PHP_OS,0,3))=='WIN') && extension_loaded('COM'));

if (!
MNOGOSEARCH_WIN32)
 die(
'MnoGoSearch COM not loaded');

/** Create COM object */
$agent = new COM('MnoGoSearch.GoSearch')
                    or die(
'Can\'t create COM object MnoGoSearch.GoSearch');
com_load_typelib('MnoGoSearch.GoSearch');
//mysql://user:passwd@host:port/database/?mode=multi
$agent->DBAddr = $params['DBAddr'];
//buggy, not work
//$agent->DBMode = $params['DBMode'];
$agent->SetCharset($params['Charset']);
$agent->SetCacheMode(true);

$q = 'q='. $query .'&np='. $_REQUEST['page'] .'&ps='. $_REQUEST['pg_size'] .'&m='. $_REQUEST['match'];
$q .= '&wm='. $_REQUEST['word_match'] .'&ul='. $_REQUEST['url_match']. '&wf='. $_REQUEST['where_find'];
$q .= '&typ='. $_REQUEST['content_type'] .'&s='. $_REQUEST['sortby'].'';

//!!! EXECUTE SEARCH QUERY
$result = $agent->Find($q);

if (
$agent->ErrorCode>0 || !$result->Valid)
   die(
'MnogoSearch win32 COM Error #'.$agent->ErrorCode.' - '.$agent->ErrorDescription);

$last=$result->LastDoc;
$first=$result->FirstDoc;
$hl_begin = '<span class="mnogosearch_hilight">';
$hl_end= '</span>';

$fetched_result=array();
$i=0;

for(
$row=$first;$row<=$last;$row++) {
   
$i=$row-$first;
   
$line = $result->Line($row);
   
$fetched_result[$i] = array(
       
'order'=>$line->Section('Order', $hl_begin, $hl_end),
       
'url'=> $line->Section('URL', $hl_begin, $hl_end),
       
'relevance'=>$line->Section('Score', $hl_begin, $hl_end),
       
'pagerank'=> $line->Section('Pop_Rank', $hl_begin, $hl_end),
       
'content_type'=> $line->Section('Content-Type', $hl_begin, $hl_end),
       
'content_length'=> $line->Section('Content-Length', $hl_begin, $hl_end),
       
'last_time'=> $line->Section('Last-Modified', $hl_begin, $hl_end),
       
'title'=> $line->Section('title', $hl_begin, $hl_end),
       
'body'=> $line->Section('body', $hl_begin, $hl_end),
       
'metadesc'=> $line->Section('meta.description', $hl_begin, $hl_end),
       
'metakeywords'=> $line->Section('meta.keywords', $hl_begin, $hl_end)
    );
}

var_dump($fetched_result);

echo
'<br/>search time : '.$result->SearchSeconds;
echo
'<br/>words stats :'.$result->WordInfo;

echo
'<br/>pg_count: '.$result->NPages;
echo
'<br/>total_rows: '. $result->Count;
echo
'<br/>first_doc: '.$result->FirstDoc;
echo
'<br/>last_doc: '.$result->LastDoc;
echo
'<br/>rows_in_page: '.$result->RowsOnPage;

?>
</pre>
m at manyone dot net 10-Jul-2002 09:23
I finally got PHP 4.2.1 to compile with mnoGoSearch 3.2.2 ; trick is to build the shared mnoGoSearch and not the static version (opposite from mnoGoSearch defaults), and not to use --disable-rpath in PHP.
brasnah-dev at brasnah dot com 27-Feb-2002 09:32
There is always a collisions for FTP name between PHP releease 4.2.0-dev and mnogosearch 3.2.3. So, first compile mnogosearch with --disable-ftp.
marten dot gustafsson at i_wont_tell_you dot com 12-Jun-2001 12:50
The name collision between php's builtin FTP functions and mnoGo's have been fixed since version 3.1.14 of mnoGoSearch according to;  http://www.mnogosearch.ru/history.html
php-install at lists dot php dot net 25-Apr-2001 03:53
I have found that if you compile php with "--with-ftp and --with-mnogosearch=/dir" you must compile and build mnogosearch with "--disable-ftp" first. There are some naming conflicts between php's ftp libs and mno's ftp libs.

Hope this helps

 
show source | credits | sitemap | contact | advertising | mirror sites