Commit 51a7c4b0 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Remove solr plugin and restore search plugin drop-down in site options (bug #702678)


Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 88a9294c
......@@ -161,7 +161,7 @@ $siteoptionform = array(
),
),
),
/* 'searchsettings' => array(
'searchsettings' => array(
'type' => 'fieldset',
'collapsible' => true,
'collapsed' => true,
......@@ -178,7 +178,7 @@ $siteoptionform = array(
'disabled' => in_array('searchplugin', $OVERRIDDEN),
),
),
),*/
),
'groupsettings' => array(
'type' => 'fieldset',
'collapsible' => true,
......
......@@ -2246,5 +2246,17 @@ function xmldb_core_upgrade($oldversion=0) {
reload_html_filters();
}
if ($oldversion < 2011032500) {
// Uninstall solr plugin; it's moving to contrib until it's fixed up.
delete_records('search_cron', 'plugin', 'solr');
delete_records('search_event_subscription', 'plugin', 'solr');
delete_records('search_config', 'plugin', 'solr');
delete_records('search_installed', 'name', 'solr');
$searchplugin = get_config('searchplugin');
if ($searchplugin == 'solr') {
set_config('searchplugin', 'internal');
}
}
return $status;
}
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2011012802;
$config->version = 2011032500;
$config->release = '1.4.0alpha2dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage search-solr
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$string['solrurl'] = 'Solr URL';
$string['indexcontrol'] = 'Index Control';
$string['reindexusers'] = 'Re-Index Users';
$string['reindexartefacts'] = 'Re-Index Artefacts';
$string['reindexviews'] = 'Re-Index pages';
?>
This diff is collapsed.
To install & activate the Mahara solr plugin using Solr 1.2 from the
solr-tomcat5.5 debian package:
For existing Maharas, make sure $cfg->searchplugin does not appear in
config.php
As admin, set searchplugin to 'Solr' in site options, and in plugin
administration, set the Solr URL. For tomcat this will usually be
something like http://foo.com:8150/solr/. For the jetty package, the
default port is 8983.
In the solr installation, edit /etc/solr/conf/solrconfig.xml.
Comment out
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
Change handleSelect to "false" in
<requestDispatcher handleSelect="true" >
Copy the schema.xml file in this directory into /etc/solr/conf/ on the
solr server.
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage search-solr
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
$type = param_variable('type', 'all');
safe_require('search', 'solr');
try {
switch ($type) {
case 'user':
PluginSearchSolr::rebuild_users();
PluginSearchSolr::commit();
PluginSearchSolr::optimize();
break;
case 'artefact':
PluginSearchSolr::rebuild_artefacts();
PluginSearchSolr::commit();
PluginSearchSolr::optimize();
break;
case 'view':
PluginSearchSolr::rebuild_views();
PluginSearchSolr::commit();
PluginSearchSolr::optimize();
break;
default:
PluginSearchSolr::rebuild_all();
break;
}
}
catch (RemoteServerException $e) {
json_reply('local', 'Unable to perform re-index. Please check the ErrorLog for more information');
}
json_headers();
$data['error'] = false;
$data['message'] = false;
echo json_encode($data);
?>
<?xml version="1.0" ?>
<schema name="Mahara" version="1.1">
<types>
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" />
<fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" />
<fieldtype name="integer" class="solr.IntField" omitNorms="true" />
<fieldtype name="long" class="solr.LongField" omitNorms="true" />
<fieldtype name="float" class="solr.FloatField" omitNorms="true" />
<fieldtype name="double" class="solr.DoubleField" omitNorms="true" />
<fieldtype name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true" />
<fieldtype name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true" />
<fieldtype name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true" />
<fieldtype name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true" />
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
is a more restricted form of the canonical representation of dateTime
http://www.w3.org/TR/xmlschema-2/#dateTime
The trailing "Z" designates UTC time and is mandatory.
Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
All other components are mandatory. -->
<fieldtype name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
<!-- solr.TextField allows the specification of custom text analyzers
specified as a tokenizer and a list of token filters. Different
analyzers may be specified for indexing and querying.
The optional positionIncrementGap puts space between multiple fields of
this type on the same document, with the purpose of preventing false phrase
matching across fields.
For more info on customizing your analyzer chain, please see...
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
-->
<!-- A text field that uses WordDelimiterFilter to enable splitting and matching of
words on case-change, alpha numeric boundaries, and non-alphanumeric chars
so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi".
Synonyms and stopwords are customized by external files, and stemming is enabled
Duplicate tokens at the same position (which may result from Stemmed Synonyms or
WordDelim parts) are removed.
-->
<fieldtype name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<filter class="solr.StopFilterFactory" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldtype>
<!-- Less flexible matching, but less false matches. Probably not ideal for product names
but may be good for SKUs. Can insert dashes in the wrong place and still match. -->
<fieldtype name="textTight" class="solr.TextField" positionIncrementGap="100" >
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldtype>
</types>
<fields>
<!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a previously defined type from the <types> section
indexed: true if this field should be indexed (searchable)
stored: true if this field should be retrievable
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with this field
(this disables length normalization and index-time boosting for the field)
-->
<field name="id" type="string" indexed="true" stored="true" />
<field name="owner" type="string" indexed="true" stored="true" />
<field name="type" type="string" indexed="true" stored="true" />
<field name="idtype" type="string" indexed="true" stored="true" />
<field name="title" type="text" indexed="true" stored="true" />
<field name="description" type="text" indexed="true" stored="true" />
<field name="tags" type="textTight" indexed="true" stored="true" multiValued="true" />
<field name="ctime" type="sint" indexed="true" stored="true" />
<field name="mtime" type="sint" indexed="true" stored="true" />
<field name="text" type="text" indexed="true" stored="false" multiValued="true" />
<dynamicField name="text_*" type="text" indexed="true" stored="true" />
<dynamicField name="ref_*" type="text" indexed="true" stored="true" />
<dynamicField name="store_*" type="text" indexed="false" stored="true" />
<dynamicField name="index_*" type="text" indexed="true" stored="false" />
<dynamicField name="string_*" type="string" indexed="true" stored="true" />
<!-- Dynamic field definitions. If a field name is not found, dynamicFields
will be used if the name matches any of the patterns.
RESTRICTION: the glob-like pattern in the name attribute must have
a "*" only at the start or the end.
EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
Longer patterns will be matched first. if equal size patterns
both match, the first appearing in the schema will be used. -->
<!-- <dynamicField name="*_i" type="sint" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_l" type="slong" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_f" type="sfloat" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_d" type="sdouble" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_dt" type="date" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_t" type="text" indexed="true" stored="true"/> -->
<!-- <dynamicField name="*_t" type="text" indexed="true" stored="true" /> -->
<!-- <dynamicField name="*_s" type="string" indexed="true" stored="true" /> -->
<!-- <dynamicField name="*_d" type="sint" indexed="true" stored="true" /> -->
<!-- <dynamicField name="*_ti" type="text" indexed="true" stored="false" /> -->
<!-- <dynamicField name="*_m" type="string" indexed="false" stored="true" /> -->
</fields>
<!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>idtype</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<solrQueryParser defaultOperator="AND" />
<defaultSearchField>text</defaultSearchField>
<!-- copyField commands copy one field to another at the time a document
is added to the index. It's used either to index the same field different
ways, or to add multiple fields to the same field for easier/faster searching. -->
<copyField source="title" dest="text"/>
<copyField source="description" dest="text"/>
<copyField source="tags" dest="text"/>
<copyField source="text_*" dest="text"/>
<copyField source="index_*" dest="text"/>
</schema>
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage search-solr
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
$config->name = 'Solr';
$config->version = 2008040200;
$config->release = '1.0.0';
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment