Topic on Extension talk:Zend Search Lucene for MediaWiki/Flow

No search result. <Solved>

32
Nick1092 (talkcontribs)

Dear,

When i try to search for a topic that i've created to test the search function, i get
no search results. I tried changing the installation path and path to my mediawiki
and run /usr/bin/php -c /etc/php.ini /usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php
and end up with this 2 error
PHP Notice: Undefined variable: wikisArray in /usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php on line 34 <br\> PHP Warning: Invalid argument supplied for foreach() in /usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php on line 34
line 34: foreach($wikisArray as $key => $val): which i think is the main cause of this problem.
I tried changing paths in PslZendSearchLuceneIndexerConfig.php but cant seems to solve this problem.
Anyone got any hint for me as to how to fix this
or anyone have similar problem previously that can point me to the right direction?

Thanks in advance.

Regards Nick

Steviex2 (talkcontribs)

wikisArray is a config var where you define your settings/Wikis. You should fill it up with your individual data. Scroll the file to see where it is set. "ps aux|grep apache" retrieves your current apache user on Linux...but I think this is not the problem.

cheers.

Nick1092 (talkcontribs)

Dear Steviex,

at the moment i just assume that i filled in the wrong details? Here's what i got at the moment on the config file

/* This part is for you! Configure multiple Wiki-instances if needed, see examples below */
   
    $GuiFlag                            = 0;

    $wikisArray[0]['xmlSource']         = "/var/www/zend/sources/internal__current.xml";
    $wikisArray[0]['indexName']         = "my_wiki";  
    $wikisArray[0]['maintenanceScript'] = "/var/www/mediawiki/maintenance/dumpBackup.php";
    $wikisArray[0]['mediaDir']          = "/var/www/mediawiki/images/";

    #$wikisArray[1]['xmlSource']         = "/var/www/zend/sources/sysdoc_current.xml";
    #$wikisArray[1]['indexName']         = "wikidb_sysdoc";
    #$wikisArray[1]['maintenanceScript'] = "/var/www/mediawiki/maintenance/dumpBackup.php";
    #$wikisArray[1]['mediaDir']          = "/var/www/mediawiki/images/"
; 
    #[...]

endif;

@preg_match_all("/(Windows)(.*?)/", $_SERVER['OS'], $matched, PREG_SET_ORDER);
/* an index dir above web root */
$indexDirName                   = "psl_search_indexes";
$PhpExecutionStringUnix         = "/usr/bin/php -c /etc/php.ini";
$PhpExecutionStringWindows      = "c:\\xampp\\php\\php.exe ";
$email                          = "";
/* file formats which will be indexed */
$additionalFileFormatsArray     = array('pdf','docx','xlsx','pptx','sql','vnd','txt','xml','xmlx','csv');

if(count($matched) > 0 ):
/* modify this to fit your needs, if you are on windows */
    $webServerUser              = "";
     $webServerUserGroup         = "";
    $zendFrameworkLibraryPath   = "C:\\xampp\\htdocs/ZF/library";
    $zendLogPath                = "C:\\xampp\\htdocs\\".$indexDirName."\\";
    $applicationPath            = "C:\\xampp\\htdocs";
else:
/* modify this to fit your needs, if you are on unix */
    $webServerUser              = "apache";
    $webServerUserGroup         = "apache";
    $zendFrameworkLibraryPath   = "/var/www/zend/ZendFramework-1.11.15/library";
    $zendLogPath                = "/var/www/zend/".$indexDirName."/";
    $applicationPath            = "/var/www/zend/";
endif;
?>

I assume the indexname means my database name?

Nick1092 (talkcontribs)

Edit : Double posted

Steviex2 (talkcontribs)

Hello,

yes indexName reflects the Lucene index name as well as the db-name. Keep in mind the first array index "0", "1" and so on reflects a dedicated Wiki, so if you actually need it for one Wiki you have to fill only $wikiArray[0]. If you need ZSL for 10 Wikis you would have to fill wikiArray[0] untill wikiArray[9]. Do not use wikiArray[1] with wikidb_sysdoc etc...its only dummy configuration data to show that the engine could be used with multiple Wiki instances.

cheers.

Nick1092 (talkcontribs)

Dear,

Yeh already commented the second wikiarray out.
I created an empty directory /var/www/zend/sources for the internal_current.xml
entered my db name, the correct dumpbackup.php and images path .
cant find what's wrong with it. Doubt it's directory permission problem.

However, when i do it through PslZslAdmin, a sysdoc_current.xml is created in the sources dir.

Regards

Steviex2 (talkcontribs)

Hi,

"sysdoc_current" should not have been created because its the second dummy data as you see above. As I remeber you have to configure in LocalSettings.php too for PslZslAdmin. Since the prefix in the name reflects your wiki its typically the name of a directory or If you want your wgScriptPath. So sysdoc_current would be named meidawiki_current in your environment. Or my_wiki_current...I m a little bit confused. Could you provide the full path to your Wiki and the real DB-Name. May be its an option to give me system access to see what happens. You can reach me over the mentioned service pages.

cheers.

Nick1092 (talkcontribs)

Hello,

My database name is my_wiki
i checked it with mysql directory to make sure there's no typo, yeh it's my_wiki
and my mediawiki path is /var/www/mediawiki

would love to let you see what's going on, maybe it's because of the semantic i installed? cause apparently it's not tested with semantic extensions.
and sorry about this , i'm quite sure i missed it somewhere ,but service pages?

Regards Nick

Steviex2 (talkcontribs)

Meanwhile it is positive tested with SMW but retrieves no special semantic data. For this purpose Solr may would be better...or customizing ZSL.

Nick1092 (talkcontribs)

hey, sorry but for some reason that link lead me.. to somewhere which i think its not suppose to be.

Steviex2 (talkcontribs)

It was the right link. Alternatively you could provide your mail address here...I dont do this.

Nick1092 (talkcontribs)

Dear,

i mean that link lead me to some NFS car site lol, i doubt my cpu got any spyware or anything, cause i tested that site on my phone safari, and other device and still pop up the same site. Unless that's really the site and i got confuse.. or that site got redirected for some reason.
I've created a new email address for this hopefully it's ok, cause if i enter my real email, i'll probably get massive bombardment of different stuff.
nicky1092@outlook.com

And sorry for troubling you with all this.


Regards

Steviex2 (talkcontribs)

Sorry its my custom spam protection...will check it later and send mail.

Nick1092 (talkcontribs)

no problem, i created a new email to protect my real email from spams as well.

Thanks again.

Steviex2 (talkcontribs)

I send an email.

Nick1092 (talkcontribs)

thanks.

113.210.3.154 (talkcontribs)

PslZendSearchLuceneIndexerConfig.php Directory : /usr/local/search/ZSearch

<?
/* This part is for command operations only, usualy you should not touch it */

setlocale(LC_ALL, 'de_CH.UTF8');
header('Content-Type: text/html; charset=utf-8');

$debugMode = 1;
ini_set('max_execution_time',36000000);

if($debugMode==1):
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
else:
    error_reporting (E_ALL ^ E_NOTICE);
    ini_set("display_errors", 0);
endif;

define("LINE_BREAK", "\n\n<br/>");

$argsNum = count($_SERVER['argv']);

if($argsNum>1):

    $wikisArray[0]['xmlSource']         = $_SERVER['argv'][1];
    $wikisArray[0]['indexName']         = $_SERVER['argv'][2];
    $wikisArray[0]['maintenanceScript'] = $_SERVER['argv'][3];

    if(isset($_SERVER['argv'][4])):
        $GuiFlag                        = $_SERVER['argv'][4];
    else:
        $GuiFlag                        = 0;
    endif;

   if(isset($_SERVER['argv'][5])):
       $wikisArray[0]['incrementUpdate']= (int)$_SERVER['argv'][5];
   else:
        $wikisArray[0]['incrementUpdate']= 0;
   endif;

   if(isset($_SERVER['argv'][6])):
        $wikisArray[0]['useFiles']      = $_SERVER['argv'][6];
   else:
        $wikisArray[0]['useFiles']      = "";
   endif;

   if(isset($_SERVER['argv'][7])):
        $wikisArray[0]['mediaDir']      = $_SERVER['argv'][7];
   else:
        $wikisArray[0]['mediaDir']      = "";
   endif;



else:

    /* This part is for you! Configure multiple Wiki-instances if needed, see examples below */

    $GuiFlag                            = 0;

    $wikisArray[0]['xmlSource']         = "/var/www/zend/sources/internal_current.xml";
    $wikisArray[0]['indexName']         = "my_wiki";
    $wikisArray[0]['maintenanceScript'] = "/var/www/mediawiki-1.20.4/maintenance/dumpBackup.php";
    $wikisArray[0]['mediaDir']          = "/var/www/mediawiki-1.20.4/images/";


endif;

@preg_match_all("/(Windows)(.*?)/", $_SERVER['OS'], $matched, PREG_SET_ORDER);
/* an index dir above web root */
$indexDirName                   = "my_wiki";
$PhpExecutionStringUnix         = "/usr/bin/php -c /etc/php.ini";
$PhpExecutionStringWindows      = "c:\\xampp\\php\\php.exe ";
$email                          = "";
/* file formats which will be indexed */
$additionalFileFormatsArray     = array('pdf','docx','xlsx','pptx','sql','vnd','txt','xml','xmlx','csv');

if(count($matched) > 0 ):
/* modify this to fit your needs, if you are on windows */
    $webServerUser              = "";
    $webServerUserGroup         = "";
    $zendFrameworkLibraryPath   = "C:\\xampp\\htdocs/ZF/library";
    $zendLogPath                = "C:\\xampp\\htdocs\\".$indexDirName."\\";
    $applicationPath            = "C:\\xampp\\htdocs";
else:
/* modify this to fit your needs, if you are on unix */
    $webServerUser              = "apache";
    $webServerUserGroup         = "apache";
    $zendFrameworkLibraryPath   = "/var/www/zend/ZendFramework-1.11.15/library";
    $zendLogPath                = "/var/www/zend/".$indexDirName."/";
    $applicationPath            = "/var/www/zend/";
endif;
?>
113.210.3.154 (talkcontribs)

LocalConfig file of mediawiki
Dir: /var/www/mediawiki
Zend lib and sources dir: /var/www/zend
Database name: my_wiki

# Zend Search Lucene Search Engine
$PslDomainDir                   = "sysdoc";
$PslPhpExecutionStringUnix      = "/usr/bin/php -c /etc/php.ini ";
$PslMaintenancePath             = "/var/www/mediawiki/maintenance/";
$PslXmlPath                     = "/var/www/zend/sources/".$PslDomainDir."_current.xml";

$wgPslZslAdminUseAutoReIndex    = false;
$wgPslZslAdminDefaultEmail      = "";
$wgPslZslAdminDumpString        = $PslPhpExecutionStringUnix.$PslMaintenancePath."dumpBackup.php --current --quiet --uploads > ".$PslXmlPath;
$wgPslZslAdminMediaDir          = "/var/www/mediawiki/images/";
$wgPslZslAdminReIndexString     = $PslPhpExecutionStringUnix."/usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php ".$PslXmlPath." wikidb_".$PslDomainDir." ".  $PslMaintenancePath."dumpBackup.php";

require_once( "$IP/extensions/PslZslAdmin/PslZslAdmin.php");

$wgSearchType                      = 'PslZendSearchLucene';
$wgPslEnableSuggestions            = true;//enables suggestions
$wgPslEnableStopWords              = false;//enables stop words
$wgPslStopWords                    = array('aber','als','am','an');

$wgPslImagePath                    = "http://host/mediawiki/extensions/PslZendSearchLucene/";
$wgPslWikiUrl                      = "http://host/mediawiki/index.php/";
$wgPslEntriesPerPage               = 20;
$wgPslUtf8DecodeResults            = false;//utf8-hint for related display issues, (play around with this if needed)
$wgPslIndexDir                     = "/var/www/zend/psl_search_indexes/wikidb_".$PslDomainDir;
$wgPslZendLibraryDir               = "/var/www/zend/ZendFramework-1.11.15/library/";
$wgPslEnablePopularSearches        = true;//requires table-create rights for MediaWikis db-account
$wgPslPopularSearchesHistory       = 365;//data remains 365 days
$wgPslProtectPopularSearches       = false;//
$wgPslHighlightColor               = "#ff6900";
$wgPslEnabaleDebugMode             = false;//debug mode
$wgPslEnableSuggestions            = true;//enables suggestions
$wgPslEnableFileSearch             = true;//enables file search
$wgPslEnablePsIpTracking           = false;//enables ip tracking for geo lacation services etc. (currently not implemented)
$wgPslEnableAnonKey                = true;//anonymous key for science
$wgPslHistoryEntries               = 30;//history entries per page
$wgPslHistoryMiniStat              = true;

$wgHiddenPrefs[] = 'searchlimit';//this entries are disabling no more needed user preferences of the old/default search
$wgHiddenPrefs[] = 'contextlines';
$wgHiddenPrefs[] = 'contextchars';
$wgHiddenPrefs[] = 'disablesuggest';
$wgHiddenPrefs[] = 'searcheverything';
$wgHiddenPrefs[] = 'searchnamespaces';
$wgPslEnableUserInHistory          = false;//enhanced knowledge management feature could tackle your country specific law!
require_once( "$IP/extensions/PslZendSearchLucene/PslZendSearchLucene.php");
Steviex2 (talkcontribs)
Steviex2 (talkcontribs)

Your are also dealing with different dir names mediawiki vs. mediawiki-1.20.4. Accordingly $PslDomainDir should reflect one of that dirs. Sysdoc is no useable default term.

108.171.100.64 (talkcontribs)

I'm running that on my own cpu to test out the features and various functions/extensions of mediawiki so just require to host name atm. And about the mediawiki vs mediawiki-1.20.4, i did a softlink on both of them , i changed the path around hoping that the folder path r the 1 causing the problem ... originally i pointed both of them to mediawiki.

86.56.58.86 (talkcontribs)

I dont know what you mean with atm and never tested it with soft links. I just would install it on the most common, simpliest way (like the others) and then later if its running begin to experiment with it.

Nick1092 (talkcontribs)

alright i tried reinstalling it, and at the moment stuck at step 3, same error as last time, cant figure out what's causing it.

/usr/bin/php -c /etc/php.ini /usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php

Below are what it print out.

 
<?
/* This part is for command operations only, usualy you should not touch it */

setlocale(LC_ALL, 'de_CH.UTF8'); 
header('Content-Type: text/html; charset=utf-8');

$debugMode = 1;
ini_set('max_execution_time',36000000);

if($debugMode==1):
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
else:
    error_reporting (E_ALL ^ E_NOTICE);
    ini_set("display_errors", 0); 
endif;

define("LINE_BREAK", "\n\n<br/>");

$argsNum = count($_SERVER['argv']);

if($argsNum>1):
    
    $wikisArray[0]['xmlSource']         = $_SERVER['argv'][1];
    $wikisArray[0]['indexName']         = $_SERVER['argv'][2];
    $wikisArray[0]['maintenanceScript'] = $_SERVER['argv'][3];
    
    if(isset($_SERVER['argv'][4])):
        $GuiFlag                        = $_SERVER['argv'][4];
    else:
        $GuiFlag                        = 0;
    endif;
    
   if(isset($_SERVER['argv'][5])):
       $wikisArray[0]['incrementUpdate']= (int)$_SERVER['argv'][5];
   else:
       $wikisArray[0]['incrementUpdate']= 0;
   endif;
   
   if(isset($_SERVER['argv'][6])):
        $wikisArray[0]['useFiles']      = $_SERVER['argv'][6];
   else:
        $wikisArray[0]['useFiles']      = "";
   endif;
   
   if(isset($_SERVER['argv'][7])):
        $wikisArray[0]['mediaDir']      = $_SERVER['argv'][7];
   else:
        $wikisArray[0]['mediaDir']      = "";
   endif;
   
   
         
else:
    
    /* This part is for you! Configure multiple Wiki-instances if needed, see examples below */
    
    $GuiFlag                            = 0;
  
    $wikisArray[0]['xmlSource']         = "/var/www/zend/sources/my_wiki_current.xml";
    $wikisArray[0]['indexName']         = "my_wiki";
    $wikisArray[0]['maintenanceScript'] = "/var/www/mediawiki/maintenance/dumpBackup.php";
    $wikisArray[0]['mediaDir']          = "/var/www/mediawiki/images";
    
            
endif;

@preg_match_all("/(Windows)(.*?)/", $_SERVER['OS'], $matched, PREG_SET_ORDER);
/* an index dir above web root */
$indexDirName                   = "psl_search_indexes";  
$PhpExecutionStringUnix         = "/usr/bin/php -c /etc/php.ini";
$PhpExecutionStringWindows      = "c:\\xampp\\php\\php.exe ";
$email                          = "info@my.reporting-mailadress.ork";
/* file formats which will be indexed */
$additionalFileFormatsArray     = array('pdf','docx','xlsx','pptx','sql','vnd','txt','xml','xmlx','csv');

if(count($matched) > 0 ):
/* modify this to fit your needs, if you are on windows */
    $webServerUser              = "";
    $webServerUserGroup         = "";
    $zendFrameworkLibraryPath   = "C:\\xampp\\htdocs/ZF/library";
    $zendLogPath                = "C:\\xampp\\htdocs\\".$indexDirName."\\";
    $applicationPath            = "C:\\xampp\\htdocs"; 
else:
/* modify this to fit your needs, if you are on unix */
    $webServerUser              = "apache";
    $webServerUserGroup         = "apache";
    $zendFrameworkLibraryPath   = "/var/www/zend/ZendFramework-1.11.15/library";
    $zendLogPath                = "/var/www/zend/".$indexDirName."/";
    $applicationPath            = "/var/www/zend/";
endif;
?>
PHP Notice: Undefined variable: wikisArray in /usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php on line 34
PHP Warning: Invalid argument supplied for foreach() in /usr/local/search/ZSearch/PslZendSearchLuceneIndexer.php on line 34
line 34: foreach($wikisArray as $key => $val)
86.56.58.86 (talkcontribs)

The error message means array wikisArray is not defined which should be happen in LuceneIndexerConfig. The second error is a side effect of the first. In line 29 auf LuceneIndexer try "echo require_once($folder."PslZendSearchLuceneIndexerConfig.php");". May be the include does not happen. You can see it if you dont get "1" as output.

Nick1092 (talkcontribs)

Tested it, output is 1, which means it found the file.
Cant figure out anything wrong with the path, so i'm gonna think maybe it's the php problem?
Or might be the OS problem? i'm using RHEL, CentOS 6, mediawiki 1.20.4. But dont think this is the problem though.

Does it normally print out the content of Config.php before printing out error?

Steviex2 (talkcontribs)

No.

Steviex2 (talkcontribs)

Next place the array definition below the if statement to see if the error still accours.

Nick1092 (talkcontribs)

if you mean placing

    $wikisArray[0]['xmlSource']         = "/var/www/zend/sources/my_wiki_current.xml";
    $wikisArray[0]['indexName']         = "my_wiki";
    $wikisArray[0]['maintenanceScript'] = "/var/www/mediawiki/maintenance/dumpBackup.php";
    $wikisArray[0]['mediaDir']          = "/var/www/mediawiki/images";

outside of the if statement, i tried that before doesnt work still same error.

I also tried adding this under the require_once line

if(empty($wikisArray)):
echo "empty";
else:
echo "not empty";
endif;

print out empty.

86.56.58.86 (talkcontribs)

Ah now I see. The whole thing isnt parsed by the PHP-Interpreter If yu get the content of the file as output. Try to use logng opening/closing tags "<?php". You colud also check if your php.ini (both for the webserver and cli) has allow_short_tags enabled. Actually this is mostly default enabled.

cheers.

Nick1092 (talkcontribs)

oh dear.. all this hustle cause the short open tags is not on...
finally got it working. haha.

thanks a lot for the help Steve and for your time too.

Steviex2 (talkcontribs)

And we claimed a new high score for ZSL thread postings YEAH! You are the second person reporting this config issue in 3 years. So I think its not on my first priority list. Anyway have fun with ZSL.

Reply to "No search result. <Solved>"