cvs: php4 /ext/mnogosearch README index.php
| From: | Sergey Kartashoff | Date: | Sat, 29 Jun 2002 10:42:52 +0000 |
| Subject: | cvs: php4 /ext/mnogosearch README index.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12627@lists.php.net to get a copy of this message | ||
gluke Sat Jun 29 06:42:52 2002 EDT
Modified files:
/php4/ext/mnogosearch README index.php
Log:
Search example (which demonstrates using of mnogosearch API) is updated.
Index: php4/ext/mnogosearch/README
diff -u php4/ext/mnogosearch/README:1.8 php4/ext/mnogosearch/README:1.9
--- php4/ext/mnogosearch/README:1.8 Mon Apr 30 06:04:46 2001
+++ php4/ext/mnogosearch/README Sat Jun 29 06:42:52 2002
@@ -1,17 +1,11 @@
$Source: /usr/repository/php4/ext/mnogosearch/README,v $
-$Id: README,v 1.8 2001/04/30 10:04:46 gluke Exp $
+$Id: README,v 1.9 2002/06/29 10:42:52 gluke Exp $
mnoGoSearch extension module for PHP4.
-For details please refer to http://search.mnogo.ru
+For details please refer to http://www.mnogosearch.org/
If used with mysql you should not use bundled mysql library
in the php distribution. You should use native mysql
library. To do this you should compile php with specefying mysql-dir
(for example --with-mysql=/usr, not --with-mysql).
-
- TODO
- ----
-
-Implement indexing functions of the library.
-For example retrieving, parsing, checking of the URL and so on...
Index: php4/ext/mnogosearch/index.php
diff -u php4/ext/mnogosearch/index.php:1.11 php4/ext/mnogosearch/index.php:1.12
--- php4/ext/mnogosearch/index.php:1.11 Mon Dec 10 02:21:49 2001
+++ php4/ext/mnogosearch/index.php Sat Jun 29 06:42:52 2002
@@ -2,12 +2,12 @@
/*
$Source: /usr/repository/php4/ext/mnogosearch/index.php,v $
- $Id: index.php,v 1.11 2001/12/10 07:21:49 gluke Exp $
+ $Id: index.php,v 1.12 2002/06/29 10:42:52 gluke Exp $
*/
-/* mnoGoSearch-php-lite v.1.2
+/* mnoGoSearch-php-lite v.1.3
* for mnoGoSearch ( formely known as UdmSearch ) free web search engine
- * (C) 2001 by Sergey Kartashoff <gluke@mail.ru>,
+ * (C) 2001-2002 by Sergey Kartashoff <gluke@mail.ru>,
* mnoGoSearch Developers Team <devel@mnogosearch.org>
*/
@@ -28,8 +28,12 @@
/* variables section */
-$dbaddr='mysql://udm:udm@/udm/';
-$dbmode='single';
+if (Udm_Api_Version() >= 30204) {
+ $dbaddr='mysql://mnogo:mnogo@/mnogo/?dbmode=single';
+} else {
+ $dbaddr='mysql://mnogo:mnogo@/mnogo/';
+ $dbmode='single';
+}
$localcharset='koi8-r';
$browsercharset='utf-8';
@@ -37,13 +41,21 @@
$ispelluseprefixes=$trackquery='no';
$spell_host=$vardir=$datadir='';
$ispellmode='text';
-$affix_file['en']='/opt/udm/ispell/en.aff';
+
+$affix_file=array();
+$spell_file=array();
+$stopwordtable_arr=array();
+$stopwordfile_arr=array();
+$synonym_arr=array();
+$searchd_arr=array();
+
+// $affix_file['en']='/opt/udm/ispell/en.aff';
// $affix_file['ru']='/opt/udm/ispell/ru.aff';
-$spell_file['en']='/opt/udm/ispell/en.dict';
+// $spell_file['en']='/opt/udm/ispell/en.dict';
// $spell_file['ru']='/opt/udm/ispell/ru.dict';
-$stopwordtable_arr[]='stopword';
+ $stopwordtable_arr[]='stopword';
// $stopwordfile_arr[]='stopwords.txt';
-$synonym_arr[]='/opt/udm/synonym/english.syn';
+// $synonym_arr[]='/opt/udm/synonym/english.syn';
$searchd_arr[]='localhost';
$minwordlength=1;
@@ -53,6 +65,27 @@
/* initialisation section */
+if(isset($HTTP_GET_VARS)){
+ while(list($var, $val)=each($HTTP_GET_VARS)){
+ $$var=$val;
+ }
+}
+if(isset($HTTP_POST_VARS)){
+ while(list($var, $val)=each($HTTP_POST_VARS)){
+ $$var=$val;
+ }
+}
+if(isset($HTTP_COOKIE_VARS)){
+ while(list($var, $val)=each($HTTP_COOKIE_VARS)){
+ $$var=$val;
+ }
+}
+if(isset($HTTP_SERVER_VARS)){
+ while(list($var, $val)=each($HTTP_SERVER_VARS)){
+ $$var=$val;
+ }
+}
+
$self=$PHP_SELF;
if ($ps=="") $ps=20;
@@ -479,7 +512,11 @@
$have_spell_flag=0;
- $udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode);
+ if (Udm_Api_Version() >= 30204) {
+ $udm_agent=Udm_Alloc_Agent($dbaddr);
+ } else {
+ $udm_agent=Udm_Alloc_Agent($dbaddr,$dbmode);
+ }
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_SIZE,$ps);
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_PAGE_NUM,$np);
@@ -613,6 +650,10 @@
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_REMOTE_ADDR,$REMOTE_ADDR);
}
+ if (Udm_Api_Version() >= 30204) {
+ if ($have_query_flag)Udm_Set_Agent_Param($udm_agent,UDM_PARAM_QUERY,$query_orig);
+ }
+
if ($m=='any') {
Udm_Set_Agent_Param($udm_agent,UDM_PARAM_SEARCH_MODE,UDM_MODE_ANY);
} elseif ($m=='all') {
@@ -924,7 +965,7 @@
print("Displaying documents $first_doc-$last_doc of total <B>$found</B>
found.\n");
$stored_link=-1;
- if ((Udm_Api_Version() >= 30203) && ($storedaddr != '')) {
+ if ((Udm_Api_Version() == 30203) && ($storedaddr != '')) {
$stored_link=Udm_Open_Stored($udm_agent,$storedaddr);
}
@@ -964,7 +1005,7 @@
print ("<A HREF=\"$url\"
TARGET=\"_blank\">$url</A>\n");
print ("($contype) $lastmod, $docsize bytes</UL></DL>\n");
- if (Udm_Api_Version() >= 30203) {
+ if (Udm_Api_Version() == 30203) {
if ((($stored_link>0) &&
(Udm_Check_Stored($udm_agent,$stored_link,Udm_CRC32($udm_agent,$url)))) ||
($stored_link==-1)) {
$storedstr="$storedocurl?rec_id=".Udm_CRC32($udm_agent,$url).
@@ -979,7 +1020,7 @@
}
}
- if ((Udm_Api_Version() >= 30203) &&
+ if ((Udm_Api_Version() == 30203) &&
($stored_link>0)) {
Udm_Close_Stored($udm_agent, $stored_link);
}