diff --git a/data/System/SolrPlugin.txt b/data/System/SolrPlugin.txt index c14492a..01b0832 100644 --- a/data/System/SolrPlugin.txt +++ b/data/System/SolrPlugin.txt @@ -1,7 +1,6 @@ -%META:TOPICINFO{author="ProjectContributor" comment="" date="1442835433" format="1.1" version="1"}% -%META:TOPICPARENT{name="Plugins"}% +%META:TOPICINFO{author="ProjectContributor" date="1443691651" format="1.1" version="1"}% ---+ Solr Plugin -%$SHORTDESCRIPTION% +%FORMFIELD{"Description"}% %TOC% @@ -139,14 +138,14 @@ cd /tools For instance to empty your index completely use: -./solrindex *:* +./soldelete *:* ---+++ solrjob cd /tools -./solrdelete ... +./solrjob ... This tool is a wrapper around =solrindex= and will use either =solrindex= or =virtualhost-solrindex= @@ -847,6 +846,8 @@ specific search applications. The destination fields are then analysed using the %$DEPENDENCIES% ---++ Change History +%TABLE{columnwidths="7em" tablewidth="100%"}% +| 01 Oct 2015: | improve default layout of search results; moved unsafe inline-javascript into a js file of its own | | 21 Sep 2015: | cache stringified attachments using Cache::FileCache now and added api to purge/clear cache regularly; \ removed =IndexExtensions= config parameter to let the stringifier decide on supported file formats; \ added support for Foswiki:Extensions/LikePlugin boosting search results by social preferences | @@ -932,11 +933,12 @@ specific search applications. The destination fields are then analysed using the | 22 Nov 2010: | fixes integration with pattern skin | | 18 Nov 2010: | initial public release | -%META:FILEATTACHMENT{name="SolrPluginSnap1.png" attachment="SolrPluginSnap1.png" attr="" comment="" date="1442835433" size="93552" user="ProjectContributor" version="1"}% -%META:FILEATTACHMENT{name="SolrPluginSnap2.png" attachment="SolrPluginSnap2.png" attr="" comment="" date="1442835433" size="158013" user="ProjectContributor" version="1"}% +%META:FILEATTACHMENT{name="SolrPluginSnap1.png" attr="" comment="" date="1443691649" size="93552" user="ProjectContributor" version="1"}% +%META:FILEATTACHMENT{name="SolrPluginSnap2.png" attr="" comment="" date="1443691649" size="158013" user="ProjectContributor" version="1"}% %META:FORM{name="PackageForm"}% %META:FIELD{name="Author" title="Author" value="Michael Daum"}% %META:FIELD{name="Copyright" title="Copyright" value="© 2009-2015, Michael Daum http://michaeldaumconsulting.com"}% +%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}% %META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/SolrPlugin"}% %META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}% %META:FIELD{name="Release" title="Release" value="%$RELEASE%"}% diff --git a/data/System/SolrSearchBaseTemplate.txt b/data/System/SolrSearchBaseTemplate.txt index 4e329e4..993f0a5 100644 --- a/data/System/SolrSearchBaseTemplate.txt +++ b/data/System/SolrSearchBaseTemplate.txt @@ -153,21 +153,20 @@
%TMPL:P{"solr::thumbnail"}%

- + {{:title}} - + %MAKETEXT{"in [_1]" args="{{:container_title}}"}%

-
- {{:~renderTopicInfo()}} +
+ {{:~formatDate(date,'%TMPL:P{"solr::dateformat"}%')}}, {{:author}}
-
{{:summary}}
{{:~getHilite(id)}}
-
- {{:~formatDate(date,'%TMPL:P{"solr::dateformat"}%')}}, {{:author}} +
+ {{:~renderTopicInfo()}}
@@ -181,16 +180,16 @@

{{:title}} - + %MAKETEXT{"in [_1]" args="{{:container_title}}"}%

-
- {{:~getHilite(id)}} -
{{:~formatDate(date,'%TMPL:P{"solr::dateformat"}%')}}, {{:author}}
+
+ {{:~getHilite(id)}} +
%TMPL:END% %{}% @@ -204,21 +203,15 @@

+ {{:name}} - + %MAKETEXT{"in [_1]" args="{{:container_title}}"}% - {{if comment}} -
{{:comment}}
- {{/if}}

-
- {{:~getHilite(id)}} -
{{:~formatDate(date,'%TMPL:P{"solr::dateformat"}%')}}, {{:author}}
- %CLEAR% %TMPL:END% %{}% @@ -229,16 +222,16 @@

{{:title}} - + %MAKETEXT{"in [_1]" args="{{:container_title}}"}%

-
- {{:~getHilite(id)}} -
{{:~formatDate(date,'%TMPL:P{"solr::dateformat"}%')}}, {{:author}}
+
+ {{:~getHilite(id)}} +
%TMPL:END% %{}% @@ -249,19 +242,19 @@

{{:name}} - + %MAKETEXT{"in [_1]" args="{{:container_title}}"}% - {{if comment}} -
{{:comment}}
- {{/if}}

-
- {{:~getHilite(id)}} -
{{:~formatDate(date,'%TMPL:P{"solr::dateformat"}%')}}, {{:author}}
+
+ {{:~getHilite(id)}} +
+ {{if comment}} +
{{:comment}}
+ {{/if}} %TMPL:END% %{}% @@ -425,25 +418,24 @@ actual input field, as well as some basic select and checkboxes }% %TMPL:DEF{"solr::inputstep"}% -
-
- - - - - -
- - - %BUTTON{"%MAKETEXT{"Search"}%" type="submit" title="%MAKETEXT{"submit the query"}%" icon="find" class="solrSubmitButton"}% -
-%TMPL:P{"solr::input::checkboxes"}% -
-
-%TMPL:P{"solr::sortby"}% -%TMPL:P{"DISsolr::displayas"}% -
-%CLEAR% +
+
+ + + + + +
+ + + %BUTTON{"%MAKETEXT{"Search"}%" type="submit" title="%MAKETEXT{"submit the query"}%" icon="find" class="solrSubmitButton"}% +
+ %TMPL:P{"solr::input::checkboxes"}% +
+
+ %TMPL:P{"solr::sortby"}% + %TMPL:P{"DISsolr::displayas"}% +
%TMPL:END% %{}% diff --git a/lib/Foswiki/Plugins/SolrPlugin.pm b/lib/Foswiki/Plugins/SolrPlugin.pm index 6a1a431..082669d 100644 --- a/lib/Foswiki/Plugins/SolrPlugin.pm +++ b/lib/Foswiki/Plugins/SolrPlugin.pm @@ -30,8 +30,8 @@ BEGIN { } } -our $VERSION = '4.10'; -our $RELEASE = '21 Jul 2015'; +our $VERSION = '4.20'; +our $RELEASE = '01 Oct 2015'; our $SHORTDESCRIPTION = 'Enterprise Search Engine for Foswiki based on [[http://lucene.apache.org/solr/][Solr]]'; our $NO_PREFS_IN_TOPIC = 1; our %searcher; @@ -164,10 +164,6 @@ sub initPlugin { http_allow => 'GET,POST', ); - Foswiki::Func::addToZone("script", "SOLRPLUGIN::SEARCHBOX", <<'HERE', "JQUERYPLUGIN"); - -HERE - Foswiki::Func::registerRESTHandler('purgeCache', sub { return getIndexer()->cache->purge; return; }, authenticate => 0, validate => 0, diff --git a/lib/Foswiki/Plugins/SolrPlugin/Index.pm b/lib/Foswiki/Plugins/SolrPlugin/Index.pm index 5fc1c9b..081a560 100644 --- a/lib/Foswiki/Plugins/SolrPlugin/Index.pm +++ b/lib/Foswiki/Plugins/SolrPlugin/Index.pm @@ -754,9 +754,7 @@ sub indexAttachment { if ($attText ne '') { $attText = $this->plainify($attText, $web, $topic); } else { - # warn for non-pdfs - $this->log("Warning: attachment $name at $web.$topic has got zero length ... maybe stringifier failed?") - unless $extension eq 'pdf'; + #$this->log("Warning: attachment $name at $web.$topic has got zero length ... maybe stringifier failed?") } my $doc = $this->newDocument(); @@ -886,6 +884,7 @@ sub optimize { my $this = shift; return unless $this->{solr}; + return if $this->{_trappedSignal}; # temporarily set a different timeout for this operation my $agent = $this->{solr}->agent(); diff --git a/pub/System/SolrPlugin/solr-searchbox.uncompressed.js b/pub/System/SolrPlugin/solr-searchbox.uncompressed.js index 0b61be7..2301eaf 100644 --- a/pub/System/SolrPlugin/solr-searchbox.uncompressed.js +++ b/pub/System/SolrPlugin/solr-searchbox.uncompressed.js @@ -1,14 +1,29 @@ -jQuery(function($) { "use strict"; - +jQuery(function($) { $(".solrSearchBox form").livequery(function() { - var $this = $(this), - action = $this.attr("action"); - $this.submit(function() { - var search = $this.find("input[name='search']"), + var $form = $(this), + action = $form.attr("action"), + $input = $form.find("input[type=text]"), + position = $.extend({ + my: "right top", + at: "right bottom+11", + }, { + my: $form.data("position-my"), + at: $form.data("position-at"), + }); + + $form.submit(function() { + var search = $form.find("input[name='search']"), href = action + ((search && search.val())?'#q='+search.val():''); window.location.href = href; return false; }); + + if (typeof($.fn.autosuggest) === 'function') { // make sure autosuggest realy is present + $input.autosuggest({ + position: position, + menuClass: 'natSearchBoxMenu' + }); + } }); }); diff --git a/pub/System/SolrPlugin/solrplugin.uncompressed.css b/pub/System/SolrPlugin/solrplugin.uncompressed.css index 9fe97bc..be74926 100644 --- a/pub/System/SolrPlugin/solrplugin.uncompressed.css +++ b/pub/System/SolrPlugin/solrplugin.uncompressed.css @@ -10,14 +10,43 @@ margin:1.3864em 0em; } .solrSearchHits h3 { - margin:0px; - font-size:100%; - line-height:1.3864em; + margin:0; padding:0px; } +.solrSearchHits h3 a { + text-decoration:none; +} +.solrSearchHits h3 .solrHitIcon { + vertical-align:middle; +} + + +.solrTopicInfo, +.solrHilite, +.solrTopicSummary, +.solrRevision { + margin:0.5em 0; + padding-left:22px; +} +.solrRevision { + font-size:95%; + margin-top:0.5em; +} +.solrRevision, +.solrRevision a { + text-decoration:none; + color:#818181; + color:#049804; +} .solrSearchHitsList .solrSearchHit { margin:1.3864em 0em; + border-top:1px solid #ddd; + padding-top:1.3864em; +} +.solrSearchHitsList .solrSearchHit:first-child { + border-top:0; + padding-top:0; } .solrSearchHitsGrid .solrSearchHit { width:17%; @@ -105,7 +134,7 @@ } .solrSearchHitsList .solrThumbnail, .solrSearchHitsList .solrImageFrame { - float:left; + float:right; margin-right:1em; } .solrThumbnail .imageSimple, @@ -118,11 +147,6 @@ overflow:hidden; } -.solrRevision, -.solrRevision a { - text-decoration:none; - color:#049804; -} .solrSortion { text-align:right; } diff --git a/templates/viewtopbar.solr.tmpl b/templates/viewtopbar.solr.tmpl index 263720e..b236903 100644 --- a/templates/viewtopbar.solr.tmpl +++ b/templates/viewtopbar.solr.tmpl @@ -2,38 +2,20 @@ %TMPL:DEF{"topbar"}%
-
-
- -
-
+ %TMPL:P{"searchbox"}% + + %JQREQUIRE{"autosuggest"}% -%TMPL:P{"searchbox::javascript"}% -%TMPL:P{"searchbox::css"}% +%ADDTOZONE{"script" id="SOLRPLUGIN::SEARCHBOX" requires="JQUERYPLUGIN::AUTOSUGGEST" text=""}%
%TMPL:P{"horizontalnavigation"}%%TMPL:END% + +%TMPL:DEF{"searchbox"}%
+ +
%TMPL:END% %TMPL:DEF{"searchbox::value"}%%URLPARAM{"search" encode="entity"}%%TMPL:END% - -%TMPL:DEF{"searchbox::javascript"}%%TMPL:END% - -%TMPL:DEF{"searchbox::css"}%%TMPL:END% +%TMPL:DEF{"searchbox::params"}%data-position-my="right top" data-position-at="right bottom+11"%TMPL:END% +%TMPL:DEF{"searchbox::placeholder"}%%MAKETEXT{"Search"}%%TMPL:END%