Skip to content

Commit

Permalink
Item13280: removed means to start solr
Browse files Browse the repository at this point in the history
- removed {AutoStartDaemon}
- removed {SolrHome}
- removed {SolrStartCmd}
- removed related checkers
- added solr.TruncateFieldUpdateProcessorFactory to the foswiki_chain
  to prevent "immense term" warnings for StrFields
  • Loading branch information
MichaelDaum committed Feb 25, 2015
1 parent ae97ee8 commit 48520ea
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 259 deletions.
53 changes: 0 additions & 53 deletions lib/Foswiki/Configure/Checkers/SolrPlugin/SolrHome.pm

This file was deleted.

35 changes: 0 additions & 35 deletions lib/Foswiki/Configure/Checkers/SolrPlugin/SolrStartCmd.pm

This file was deleted.

71 changes: 0 additions & 71 deletions lib/Foswiki/Configure/Checkers/SolrPlugin/SupportedLanguages.pm

This file was deleted.

4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/SolrPlugin.pm
Expand Up @@ -31,8 +31,8 @@ BEGIN {
}
}

our $VERSION = '2.30';
our $RELEASE = '2.30';
our $VERSION = '3.00_0001';
our $RELEASE = '25 Feb 2015';
our $SHORTDESCRIPTION = 'Enterprise Search Engine for Foswiki based on [[http://lucene.apache.org/solr/][Solr]]';
our $NO_PREFS_IN_TOPIC = 1;
our %searcher;
Expand Down
33 changes: 0 additions & 33 deletions lib/Foswiki/Plugins/SolrPlugin/Base.pm
Expand Up @@ -58,39 +58,6 @@ sub new {
return $this;
}

##############################################################################
sub startDaemon {
my ($this) = @_;

my $maxStartRetries = 3;

my $toolsDir = $Foswiki::cfg{ToolsDir} || $Foswiki::cfg{WorkingDir} . "/../tools"; # try to cope with old foswikis w/o a ToolsDir setting
my $autoStartCmd = $Foswiki::cfg{SolrPlugin}{SolrStartCmd} || $toolsDir . '/solrstart %SOLRHOME|F%';
my $solrHome = $Foswiki::cfg{SolrPlugin}{SolrHome} || $Foswiki::cfg{WorkingDir} . "/../solr";

for (my $tries = 1; $tries <= $maxStartRetries; $tries++) {

# trying to autostart
$this->log("autostarting solr at $solrHome");

unless (-f $solrHome . "/start.jar") {
$this->log("ERROR: start.jar not found ... aborting autostart");
last;
}

my ($stdout, $exit, $stderr) = Foswiki::Sandbox::sysCommand(undef, $autoStartCmd, SOLRHOME => $solrHome);

if ($exit) {
$this->log("ERROR: $stderr");
sleep 1;
} else {
$this->log("... waiting for solr to start up");
sleep 5;
last;
}
}
}

##############################################################################
sub connect {
my ($this) = @_;
Expand Down
14 changes: 0 additions & 14 deletions lib/Foswiki/Plugins/SolrPlugin/Config.spec
Expand Up @@ -71,20 +71,6 @@ $Foswiki::cfg{SolrPlugin}{UpdateUrl} = '';
# setting will override any {Url} setting above.
$Foswiki::cfg{SolrPlugin}{SearchUrl} = '';

# **BOOLEAN**
# Enable this flag to automatically start a solr instance coming with this plugin
$Foswiki::cfg{SolrPlugin}{AutoStartDaemon} = 0;

# **COMMAND DISPLAY_IF {SolrPlugin}{AutoStartDaemon}**
# Command used to start the solr instance. Note that <code>solrstart</code> is a shell script wrapping
# around the actual startup routine
$Foswiki::cfg{SolrPlugin}{SolrStartCmd} = '$Foswiki::cfg{ToolsDir}/solrstart %SOLRHOME|F%';

# **PATH DISPLAY_IF {SolrPlugin}{AutoStartDaemon}**
# Path to the directory containing the <code>start.jar</code> file. That's where the jetty engine is
# located and where solr puts its data further down the directory structure.
$Foswiki::cfg{SolrPlugin}{SolrHome} = '';

# **PERL**
# List of supported languages. These are the locale IDs as supported for by the schema.xml configuration
# file for solr. For each language ID there's a text field named text_&lt;ID&gt; that will be filled
Expand Down
10 changes: 5 additions & 5 deletions lib/Foswiki/Plugins/SolrPlugin/Index.pm
Expand Up @@ -28,6 +28,7 @@ use Foswiki::Form ();
use Foswiki::OopsException ();
use Foswiki::Time ();
use Foswiki::Contrib::Stringifier ();
use Data::Dump qw(dump);

use constant TRACE => 0; # toggle me
use constant VERBOSE => 1; # toggle me
Expand Down Expand Up @@ -640,12 +641,9 @@ sub indexTopic {
$value =~ s/<[^>]*>/ /g; # remove all HTML tags
$value = $this->discardIllegalChars($value); # remove illegal characters

$doc->add_fields(
$fieldName . '_s' => $value,
$fieldName . '_search' => $value,
) if defined $value && $value ne '';
$doc->add_fields($fieldName . '_s' => $value) if defined $value && $value ne '';
} else {
$doc->add_fields($fieldName . $fieldType => $value,) if defined $value && $value ne '';
$doc->add_fields($fieldName . $fieldType => $value) if defined $value && $value ne '';
}
}
}
Expand Down Expand Up @@ -740,6 +738,8 @@ sub indexTopic {
$t1 = [Time::HiRes::gettimeofday];
}

#print STDERR dump($doc)."\n";

# add the document to the index
try {
$this->add($doc);
Expand Down
5 changes: 0 additions & 5 deletions lib/Foswiki/Plugins/SolrPlugin/MANIFEST
Expand Up @@ -12,9 +12,6 @@ data/System/SolrSideBar.txt 0644
data/System/SolrWikiUsersViewTemplate.txt 0644
data/System/WebChangesViewTemplate.txt 0644
lib/CharsetDetector.pm 0644
lib/Foswiki/Configure/Checkers/SolrPlugin/SolrHome.pm 0644
lib/Foswiki/Configure/Checkers/SolrPlugin/SolrStartCmd.pm 0644
lib/Foswiki/Configure/Checkers/SolrPlugin/SupportedLanguages.pm 0644
lib/Foswiki/Plugins/SolrPlugin/Autosuggest.pm 0644
lib/Foswiki/Plugins/SolrPlugin/Base.pm 0644
lib/Foswiki/Plugins/SolrPlugin/Config.spec 0644
Expand Down Expand Up @@ -147,12 +144,10 @@ solr/configsets/foswiki_configs/conf/typemap.txt 0644
solr/cores/foswiki/core.properties 0644
solr/.htaccess 0644
templates/viewtopbar.solr.tmpl 0644
tools/etc-defaults-jetty 0755
tools/solrdelete 0755
tools/solrindex 0755
tools/solrindex_all 0755
tools/solrjob 0755
tools/solrstart 0755
tools/virtualhosts-solrdelete 0755
tools/virtualhosts-solrindex 0755
tools/virtualhosts-solrsearch 0755
9 changes: 1 addition & 8 deletions lib/Foswiki/Plugins/SolrPlugin/Search.pm
Expand Up @@ -40,14 +40,7 @@ sub new {

throw Error::Simple("no solr url defined") unless defined $this->{url};

if (!$this->connect() && $Foswiki::cfg{SolrPlugin}{AutoStartDaemon}) {
$this->startDaemon();
$this->connect();
}

unless ($this->{solr}) {
$this->log("ERROR: can't conect solr daemon");
}
$this->log("ERROR: can't conect solr daemon") unless $this->connect;

return $this;
}
Expand Down
7 changes: 4 additions & 3 deletions solr/configsets/foswiki_configs/conf/schema.xml
Expand Up @@ -20,7 +20,7 @@

<types>
<!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" />

<!-- boolean type: "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
Expand Down Expand Up @@ -617,7 +617,7 @@
catenateNumbers="1"
catenateAll="0"
preserveOriginal="1"
stemEnglishPossessive="1"
stemEnglishPossessive="1"
/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" />
Expand All @@ -640,7 +640,7 @@
catenateNumbers="0"
catenateAll="0"
preserveOriginal="1"
stemEnglishPossessive="1"
stemEnglishPossessive="1"
/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
Expand Down Expand Up @@ -1193,6 +1193,7 @@
<copyField source="topic" dest="topic_search" />
<copyField source="web" dest="web_search" />
<copyField source="webtopic" dest="webtopic_search"/>
<copyField source="*_s" dest="*_search"/>

<copyField source="attachment" dest="catchall"/>
<copyField source="category" dest="catchall"/>
Expand Down
4 changes: 4 additions & 0 deletions solr/configsets/foswiki_configs/conf/solrconfig.xml
Expand Up @@ -1784,6 +1784,10 @@
-->

<updateRequestProcessorChain name="foswiki_chain">
<processor class="solr.TruncateFieldUpdateProcessorFactory">
<str name="typeClass">solr.StrField</str>
<int name="maxLength">32765</int>
</processor>
<processor class="org.apache.solr.update.processor.LangDetectLanguageIdentifierUpdateProcessorFactory">
<!-- processor class="org.apache.solr.update.processor.TikaLanguageIdentifierUpdateProcessorFactory"-->
<lst name="defaults">
Expand Down
5 changes: 0 additions & 5 deletions tools/etc-defaults-jetty

This file was deleted.

25 changes: 0 additions & 25 deletions tools/solrstart

This file was deleted.

0 comments on commit 48520ea

Please sign in to comment.