diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
index b1bed3ce1a..23ac18c6d3 100644
--- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
+++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
@@ -131,7 +131,7 @@ class PhraseaEngine implements SearchEngineInterface
*/
public function hasStemming()
{
- return false;
+ return true;
}
/**
@@ -530,6 +530,7 @@ class PhraseaEngine implements SearchEngineInterface
, $this->options->getSearchType() == SearchEngineOptions::RECORD_GROUPING ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY
, $sort
, $BF
+ , $this->options->isStemmed() ? $this->options->getLocale() : null
);
if ($results) {
@@ -701,9 +702,9 @@ class PhraseaEngine implements SearchEngineInterface
}
if ($this->needthesaurus[$sbas_id]) {
- if ($databox->get_dom_thesaurus()) {
- $this->qp[$sbas_id]->thesaurus2($this->indep_treeq[$sbas_id], $sbas_id, $databox->get_dbname(), $databox->get_dom_thesaurus(), true);
- $this->qp['main']->thesaurus2($this->indep_treeq['main'], $sbas_id, $databox->get_dbname(), $databox->get_dom_thesaurus(), true);
+ if (($domth = $databox->get_dom_thesaurus())) {
+ $this->qp[$sbas_id]->thesaurus2($this->indep_treeq[$sbas_id], $sbas_id, $databox->get_dbname(), $domth, true);
+ $this->qp['main']->thesaurus2($this->indep_treeq['main'], $sbas_id, $databox->get_dbname(), $domth, true);
}
}
diff --git a/lib/classes/module/console/taskrun.php b/lib/classes/module/console/taskrun.php
index a761707c60..ae8dadc6a1 100644
--- a/lib/classes/module/console/taskrun.php
+++ b/lib/classes/module/console/taskrun.php
@@ -118,7 +118,9 @@ class module_console_taskrun extends Command
if (($ttyloglevel = strtoupper($input->getOption('ttyloglevel'))) != '') {
if (!array_key_exists($ttyloglevel, $lib2v)) {
- throw new RuntimeException("Bad value '%s' for option loglevel\nuse DEBUG|INFO|WARNING|ERROR|CRITICAL|ALERT", $ttyloglevel);
+ throw(new RuntimeException(sprintf(
+ "Bad value '%s' for option loglevel\nuse DEBUG|INFO|WARNING|ERROR|CRITICAL|ALERT", $ttyloglevel))
+ );
}
$handler = new StreamHandler("php://stdout", $lib2v[$ttyloglevel]);
$logger->pushHandler($handler);
diff --git a/lib/classes/task/period/cindexer.php b/lib/classes/task/period/cindexer.php
index 13e4bfe541..1fac15784c 100644
--- a/lib/classes/task/period/cindexer.php
+++ b/lib/classes/task/period/cindexer.php
@@ -79,6 +79,18 @@ class task_period_cindexer extends task_abstract
*/
protected $debugmask;
+ /**
+ *
+ * @var string
+ */
+ protected $stem;
+
+ /**
+ *
+ * @var string
+ */
+ protected $sortempty;
+
/**
*
* @var string
@@ -125,13 +137,13 @@ class task_period_cindexer extends task_abstract
$request = http_request::getInstance();
$parm2 = $request->get_parms(
- 'binpath', 'host', 'port', 'base', 'user', 'password', 'socket', 'use_sbas', 'nolog', 'clng', 'winsvc_run', 'charset', 'debugmask'
+ 'binpath', 'host', 'port', 'base', 'user', 'password', 'socket', 'use_sbas', 'nolog', 'clng', 'winsvc_run', 'charset', 'debugmask', 'stem', 'sortempty'
);
$dom = new DOMDocument();
$dom->formatOutput = true;
if ($dom->loadXML($oldxml)) {
$xmlchanged = false;
- foreach (array("str:binpath", "str:host", "str:port", "str:base", "str:user", "str:password", "str:socket", "boo:use_sbas", "boo:nolog", "str:clng", "boo:winsvc_run", "str:charset", 'str:debugmask') as $pname) {
+ foreach (array("str:binpath", "str:host", "str:port", "str:base", "str:user", "str:password", "str:socket", "boo:use_sbas", "boo:nolog", "str:clng", "boo:winsvc_run", "str:charset", 'str:debugmask', 'str:stem', 'str:sortempty') as $pname) {
$ptype = substr($pname, 0, 3);
$pname = substr($pname, 4);
$pvalue = $parm2[$pname];
@@ -200,6 +212,8 @@ class task_period_cindexer extends task_abstract
nolog.checked = isyes(xml.find("nolog").text());
winsvc_run.checked = isyes(xml.find("winsvc_run").text());
charset.value = xml.find("charset").text();
+ stem.value = xml.find("stem").text();
+ sortempty.value = xml.find("sortempty").text();
debugmask.value = 0|xml.find("debugmask").text();
}
}
@@ -231,6 +245,10 @@ class task_period_cindexer extends task_abstract
cmd += " -n";
if(clng.value)
cmd += " -c=" + clng.value;
+ if(stem.value)
+ cmd += " --stem=" + stem.value;
+ if(sortempty.value)
+ cmd += " --sort-empty=" + sortempty.value;
if(debugmask.value)
cmd += " -d=" + debugmask.value;
if(winsvc_run.checked)
@@ -294,6 +312,22 @@ class task_period_cindexer extends task_abstract
:
+ :
+
+
+
+
+
+
+
@@ -324,6 +358,8 @@ class task_period_cindexer extends task_abstract
$this->socket = trim($sx_task_settings->socket);
$this->use_sbas = p4field::isyes(trim($sx_task_settings->use_sbas));
$this->charset = trim($sx_task_settings->charset);
+ $this->stem = trim($sx_task_settings->stem);
+ $this->sortempty = trim($sx_task_settings->sortempty);
$this->debugmask = (int) (trim($sx_task_settings->debugmask));
$this->nolog = p4field::isyes(trim($sx_task_settings->nolog));
$this->winsvc_run = p4field::isyes(trim($sx_task_settings->winsvc_run));
@@ -390,6 +426,14 @@ class task_period_cindexer extends task_abstract
$args[] = '--default-character-set=' . $this->charset;
$args_nopwd[] = '--default-character-set=' . $this->charset;
}
+ if ($this->stem) {
+ $args[] = '--stem=' . $this->stem;
+ $args_nopwd[] = '--stem=' . $this->stem;
+ }
+ if ($this->sortempty) {
+ $args[] = '--sort-empty=' . $this->sortempty;
+ $args_nopwd[] = '--sort-empty=' . $this->sortempty;
+ }
if ($this->debugmask > 0) {
$args[] = '-d=' . $this->debugmask;
$args_nopwd[] = '-d=' . $this->debugmask;
diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php
index 944df27925..ddb987c9c8 100644
--- a/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php
+++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php
@@ -29,6 +29,9 @@ class PhraseaEngineTest extends SearchEngineAbstractTest
. ' -b=' . $appbox->get_dbname() . ' -u=' . $appbox->get_user()
. ' -p=' . $appbox->get_passwd()
. ' --default-character-set=utf8 -n -o --quit';
+ if(($stemms = implode(',', $stemms)) !== '') {
+ $cmd .= ' --stem='.$stemms;
+ }
$process = new Process($cmd);
$process->run();
}