diff --git a/languages/cs.ini b/languages/cs.ini index 25bac8fb912acd3d0e6ce3100267785cbe090268..545d8bfdbb8c248df78c1a5adfa01f2ed38c6aa1 100644 --- a/languages/cs.ini +++ b/languages/cs.ini @@ -274,6 +274,8 @@ fav_list_delete = "Seznam byl odstranÄ›n." fav_list_delete_cancel = "Seznam nebyl odstranÄ›n." fav_list_delete_fail = "Promiňte, ale doÅ¡lo k chybÄ›. Váš seznam nebyl odstranÄ›n." Fee = Poplatek +Feedback Email = "E-mail" +feedback_name = "Jméno" filter_wildcard = "Libovolný" Find = Hledat Find More = "Objevte vÃce" @@ -285,6 +287,7 @@ fine_limit_patron = "Dosáhli jste VaÅ¡eho limitu upomÃnek, vaÅ¡e výpůjÄky p First Name = "Jméno" fix_metadata = "Ano, opravit metadata." for search = "pro vyhledávánÃ" +Form Submitted! = "Formuláø byl odeslán!" Format = Médium found = nalezeno From = "Od" @@ -535,6 +538,7 @@ Place a Hold = "Požadavek" Playing Time = "Doba pÅ™ehrávánÃ" Please check back soon = "ProsÃm, zkuste to znovu pozdÄ›ji" Please contact the Library Reference Department for assistance = "Pro pomoc se obraÅ¥te na pracovnÃky knihovny:" +Please enable JavaScript. = "Pro správnou funkci je tøeba mÃt zapnutý javascript." Posted by = "Od" posted_on = "dne" Preferred Library = "Preferovaná knihovna" @@ -624,6 +628,7 @@ Select your carrier = "Vyberte vaÅ¡eho operátora" Selected = "Vybráno" select_page = "Vybrat vÅ¡e" Send = OK +Send us your feedback! = "Sdìlte nám svùj názor!" Sensor Image = "Sensor Image" Serial = Seriál Series = Edice @@ -679,6 +684,7 @@ test_fail = "Neúspěšné" test_fix = "Opravit" test_ok = "OK" Text this = "Zaslat SMS" +Thank you for your feedback. = "Dìkujeme za Váš názor." That email address is already used = "Tato e-mailová adresa je již použita" That username is already taken = "Toto uživatelské jméno již existuje" The record you selected is not part of any of your lists. = "Zvolený záznam nenà souÄástà žádného vaÅ¡eho seznamu." @@ -754,4 +760,4 @@ Your Profile = "Váš profil" Your search terms = "Vyhledávané termÃny" Your Tags = "VaÅ¡e tagy" Zip = PSÄŒ -zoom = "PÅ™iblÞit" +zoom = "PÅ™iblÞit" \ No newline at end of file diff --git a/languages/ru.ini b/languages/ru.ini index 8a863de43e97a3b8476ff4c20123306d017cddc2..b8393536850714f7341dcb9e9fda0421deeca393 100644 --- a/languages/ru.ini +++ b/languages/ru.ini @@ -291,6 +291,8 @@ fav_list_delete = "СпиÑок избранного был удален" fav_list_delete_cancel = "Ðтот ÑпиÑок не удален." fav_list_delete_fail = "Произошла ошибка. Ваш ÑпиÑок удален." Fee = Ð²Ð·Ð½Ð¾Ñ +Feedback Email = "Email-обратной ÑвÑзи" +feedback_name = "ИмÑ" filter_wildcard = "Любой" Find = Ðайти Find More = "Подробный проÑмотр" @@ -302,6 +304,7 @@ fine_limit_patron = "ДоÑтигнуто Ваше ограничение по First Name = "ИмÑ" fix_metadata = "Да, иÑправить метаданные; Ñ Ð¿Ð¾Ð´Ð¾Ð¶Ð´Ñƒ" for search = "Ð´Ð»Ñ Ð¿Ð¾Ð¸Ñка" +Form Submitted! = "Форма предоÑтавлена!" Format = Формат found = найдено From = "от" @@ -552,6 +555,7 @@ Place a Hold = "ПомеÑтить задолженноÑÑ‚ÑŒ" Playing Time = "Ð’Ñ€ÐµÐ¼Ñ Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ" Please check back soon = "Перепроверьте Ñкорее" Please contact the Library Reference Department for assistance = "ОбратитеÑÑŒ за помощью к библиотекарÑм" +Please enable JavaScript. = "Включите JavaScript." Posted by = "Отправлено" posted_on = "вкл" Preferred Library = "ÐŸÑ€ÐµÐ´Ð¿Ð¾Ñ‡Ñ‚Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð±Ð¸Ð±Ð»Ð¸Ð¾Ñ‚ÐµÐºÐ°" @@ -641,6 +645,7 @@ Select your carrier = "Выбрать ноÑитель" Selected = "Выбран" select_page = "Выбрать Ñтраницу" Send = Отправить +Send us your feedback! = "Отправьте ответное Ñообщение!" Sensor Image = "Значок ÑенÑора" Serial = Ð¡ÐµÑ€Ð¸Ñ Series = Серии @@ -696,6 +701,7 @@ test_fail = "Сбой" test_fix = "ФикÑациÑ" test_ok = "ОК" Text this = "Отправить по sms" +Thank you for your feedback. = "Благодарю за ответ." That email address is already used = "Ðтот E-mail Ð°Ð´Ñ€ÐµÑ ÑƒÐ¶Ðµ иÑпользуетÑÑ" That username is already taken = "Ðто Ð¸Ð¼Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ ÑƒÐ¶Ðµ иÑпользуетÑÑ" The record you selected is not part of any of your lists. = "Ð’Ñ‹Ð±Ñ€Ð°Ð½Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ не входит в ÑоÑтав ни одного ÑпиÑка." diff --git a/languages/tr.ini b/languages/tr.ini index b31fc7e517f4a9f72c181e3ca779d79828fb6463..62c06cfbce7574790f9ffe891e47b0504567c7ae 100644 --- a/languages/tr.ini +++ b/languages/tr.ini @@ -285,6 +285,8 @@ fav_list_delete = "Favori listeniz silindi" fav_list_delete_cancel = "Bu liste silinmedi" fav_list_delete_fail = "Bir hata oluÅŸtu. Listeniz silinemedi." Fee = "Gecikme Cezası" +Feedback Email = "Görüsleriniz" +feedback_name = "Adiniz" filter_wildcard = "Herhangi" Find = Tara Find More = "DiÄŸer Taramalar" @@ -296,6 +298,7 @@ fine_limit_patron = "Ceza limitiniz dolmuÅŸtur, kayıtları uzatamazsınız." First Name = Ad fix_metadata = "Evet, Metadatayı düzelt; BekleyeceÄŸim" for search = "sonuç. Aranan kelime" +Form Submitted! = "Formunuz Gönderildi!" Format = "Materyal Türü" found = "Bulundu" From = "den" @@ -546,6 +549,7 @@ Place a Hold = "Rezerve" Playing Time = "Oyun Zamanı" Please check back soon = "Daha sonra tekrar kontrol ediniz" Please contact the Library Reference Department for assistance = "Sistem sorumlusuna e-posta yolla" +Please enable JavaScript. = "Lütfen JavaScripti etkinlestirin." Posted by = "Gönderildi" posted_on = "on" Preferred Library = "Tercih Edilen Kütüphane" @@ -635,6 +639,7 @@ Select your carrier = "Ä°letici Seçin" Selected = "SeçilmiÅŸler" select_page = "Sayfa Seç" Send = "Gönder" +Send us your feedback! = "Bize görüslerinizi gönderin!" Sensor Image = "Sensör Resmi" Serial = "Süreli" Series = "Seri Bilgileri" @@ -690,6 +695,7 @@ test_fail = "BaÅŸarısız" test_fix = "Düzelt" test_ok = "Tamam" Text this = "Telefona gönder" +Thank you for your feedback. = "Görüsleriniz için tesekkür ederiz." That email address is already used = "Bu eposta adresi daha önce kullanıldı" That username is already taken = "Bu kullanıcı adı daha önce alınmış" The record you selected is not part of any of your lists. = "SeçmiÅŸ olduÄŸunuz kayıt herhangi bir listenin parçası deÄŸildir." diff --git a/module/VuFind/src/VuFind/Auth/Manager.php b/module/VuFind/src/VuFind/Auth/Manager.php index 2e2ee560ae9464698baf629a81c846c775bf596d..07e1533296f9d69b3a1c4126836efbee54a784af 100644 --- a/module/VuFind/src/VuFind/Auth/Manager.php +++ b/module/VuFind/src/VuFind/Auth/Manager.php @@ -69,6 +69,13 @@ class Manager implements ServiceLocatorAwareInterface */ protected $ilsAccount = false; + /** + * Cache for current logged in user object + * + * @var \VuFind\Db\Row\User + */ + protected $currentUser = false; + /** * Service locator * @@ -189,8 +196,9 @@ class Manager implements ServiceLocatorAwareInterface // Clear out cached ILS connection. $this->ilsAccount = false; - // Clear out the cached user object. - unset($this->session->user); + // Clear out the cached user object and session entry. + $this->currentUser = false; + unset($this->session->userId); // Destroy the session for good measure, if requested. if ($destroy) { @@ -213,17 +221,16 @@ class Manager implements ServiceLocatorAwareInterface */ public function isLoggedIn() { - $user = isset($this->session->user) ? $this->session->user : false; - - // User may have been serialized into session; if so, we may need to - // restore its service locator, since SL's can't be serialized: - if ($user && null === $user->getServiceLocator()) { - $user->setServiceLocator( - $this->getServiceLocator()->get('VuFind\DbTablePluginManager') - ); + // If user object is not in cache, but user ID is in session, + // load the object from the database: + if (!$this->currentUser && isset($this->session->userId)) { + $results = $this->getServiceLocator() + ->get('VuFind\DbTablePluginManager')->get('user') + ->select(array('id' => $this->session->userId)); + $this->currentUser = count($results) < 1 + ? false : $results->current(); } - - return $user; + return $this->currentUser; } /** @@ -249,7 +256,8 @@ class Manager implements ServiceLocatorAwareInterface */ public function updateSession($user) { - $this->session->user = $user; + $this->currentUser = $user; + $this->session->userId = $user->id; } /** diff --git a/module/VuFind/src/VuFind/Controller/AbstractSearch.php b/module/VuFind/src/VuFind/Controller/AbstractSearch.php index cd1fd8f1984ce66a9a74dbb6f06933f2beb9cc94..1adb027f0103fa287f44d6d164d208caa5fad8da 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractSearch.php +++ b/module/VuFind/src/VuFind/Controller/AbstractSearch.php @@ -234,17 +234,19 @@ class AbstractSearch extends AbstractBase if ($this->resultScrollerActive()) { $this->resultScroller()->init($results); } - } catch (\VuFindSearch\Backend\Exception\RequestParseErrorException $e) { - // If it's a parse error or the user specified an invalid field, we - // should display an appropriate message: - $view->parseError = true; - - // We need to create and process an "empty results" object to - // ensure that recommendation modules and templates behave - // properly when displaying the error message. - $view->results = $this->getResultsManager()->get('EmptySet'); - $view->results->setParams($params); - $view->results->performAndProcessSearch(); + } catch (\VuFindSearch\Backend\Exception\BackendException $e) { + if ($e->hasTag('VuFind\Search\ParserError')) { + // If it's a parse error or the user specified an invalid field, we + // should display an appropriate message: + $view->parseError = true; + + // We need to create and process an "empty results" object to + // ensure that recommendation modules and templates behave + // properly when displaying the error message. + $view->results = $this->getResultsManager()->get('EmptySet'); + $view->results->setParams($params); + $view->results->performAndProcessSearch(); + } } // Save statistics: if ($this->logStatistics) { diff --git a/module/VuFind/src/VuFind/Db/Row/User.php b/module/VuFind/src/VuFind/Db/Row/User.php index ce91fc12d71d3dd2173c79eb17289080ff061df6..43504c336bdf172251d94418e1d46e19b78832a6 100644 --- a/module/VuFind/src/VuFind/Db/Row/User.php +++ b/module/VuFind/src/VuFind/Db/Row/User.php @@ -68,43 +68,6 @@ class User extends ServiceLocatorAwareGateway parent::__construct('id', 'user', $adapter); } - /** - * Sleep magic method -- the service locator can't be serialized, so we need to - * exclude it from serialization. Since we can't obtain a new locator in the - * __wakeup() method, it needs to be re-injected by the \VuFind\Auth\Manager - * (see the isLoggedIn() method of that class). - * - * @return array - */ - public function __sleep() - { - $vars = get_object_vars($this); - unset($vars['serviceLocator']); - $vars = array_keys($vars); - return $vars; - } - - /** - * Saves the properties to the database. - * - * This performs an intelligent insert/update, and reloads the - * properties with fresh data from the table on success. - * - * @return mixed The primary key value(s), as an associative array if the - * key is compound, or a scalar if the key is single-column. - */ - public function save() - { - // Since this object is frequently stored in the session, we should - // reconnect to the database as part of the save action to prevent - // exceptions: - $this->sql = new Sql( - $this->getServiceLocator()->getServiceLocator()->get('VuFind\DbAdapter'), - $this->table - ); - return parent::save(); - } - /** * Reset ILS login credentials. * @@ -331,7 +294,10 @@ class User extends ServiceLocatorAwareGateway ); $select->where->equalTo('user_list.user_id', $userId); $select->group( - array('id', 'user_id', 'title', 'description', 'created', 'public') + array( + 'user_list.id', 'user_list.user_id', 'title', 'description', + 'created', 'public' + ) ); $select->order(array('title')); }; diff --git a/module/VuFind/src/VuFind/Search/Solr/V3/ErrorListener.php b/module/VuFind/src/VuFind/Search/Solr/V3/ErrorListener.php index 15c8a61cfde4e37c1c00e2deb8a79a624aa3e4a4..620c72293321c4ea413503592fc19e62f6489d30 100644 --- a/module/VuFind/src/VuFind/Search/Solr/V3/ErrorListener.php +++ b/module/VuFind/src/VuFind/Search/Solr/V3/ErrorListener.php @@ -44,9 +44,8 @@ use Zend\EventManager\EventInterface; */ class ErrorListener { - /** - * Backends ot listen on. + * Backends to listen on. * * @var array */ @@ -78,8 +77,8 @@ class ErrorListener $error = $event->getTarget(); if ($error instanceOf HttpErrorException) { $reason = $error->getResponse()->getReasonPhrase(); - if (stristr($error, 'org.apache.lucene.queryParser.ParseException') - || stristr($error, 'undefined field') + if (stristr($reason, 'org.apache.lucene.queryParser.ParseException') + || stristr($reason, 'undefined field') ) { $error->addTag('VuFind\Search\ParserError'); } diff --git a/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php b/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php new file mode 100644 index 0000000000000000000000000000000000000000..b66bab8cfabbe6adaf95c618432dd80d8fd1a6ac --- /dev/null +++ b/module/VuFind/src/VuFind/Search/Solr/V4/ErrorListener.php @@ -0,0 +1,100 @@ +<?php + +/** + * SOLR 4.x error listener. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2013. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package Search + * @author David Maus <maus@hab.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ + +namespace VuFind\Search\Solr\V4; + +use VuFindSearch\Backend\Exception\HttpErrorException; + +use Zend\EventManager\EventInterface; + +/** + * SOLR 3.x error listener. + * + * @category VuFind2 + * @package Search + * @author David Maus <maus@hab.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ +class ErrorListener +{ + /** + * Backends to listen on. + * + * @var array + */ + protected $backends; + + /** + * Constructor. + * + * @param array $backends Name of backends to listen on + * + * @return void + */ + public function __construct(array $backends) + { + $this->backends = $backends; + } + + /** + * VuFindSearch.error + * + * @param EventInterface $event Event + * + * @return EventInterface + */ + public function onSearchError(EventInterface $event) + { + $backend = $event->getParam('backend'); + if (in_array($backend, $this->backends)) { + $error = $event->getTarget(); + if ($error instanceOf HttpErrorException) { + $body = $error->getResponse()->getBody(); + $type = $error->getResponse()->getHeaders()->get('content-type') + ->toString(); + if (stristr($type, 'json')) { + $body = json_decode($body); + $reason = isset($body->error->msg) ? $body->error->msg : ''; + } else if (stristr($type, 'xml')) { + // TODO -- parse XML response + $reason = ''; + } else { + $reason = ''; + } + if (stristr($reason, 'org.apache.solr.search.SyntaxError') + || stristr($reason, 'undefined field') + ) { + $error->addTag('VuFind\Search\ParserError'); + } + } + } + return $event; + } +} \ No newline at end of file diff --git a/module/VuFind/tests/fixtures/response/solr/solr4-alphabrowse-error b/module/VuFind/tests/fixtures/response/solr/solr4-alphabrowse-error new file mode 100644 index 0000000000000000000000000000000000000000..ed794c06e1662fe5540612a300e8afc5f7dd934c --- /dev/null +++ b/module/VuFind/tests/fixtures/response/solr/solr4-alphabrowse-error @@ -0,0 +1,9 @@ +HTTP/1.1 500 Server Error +Cache-Control: no-cache, no-store +Pragma: no-cache +Expires: Sat, 01 Jan 2000 01:00:00 GMT +Last-Modified: Wed, 29 May 2013 15:35:01 GMT +ETag: "13ef0ed92c7" +Content-Type: application/json; charset=UTF-8 + +{"responseHeader":{"status":500,"QTime":135},"error":{"msg":"I couldn't find a browse index at: /home/dkatz/vufind3/solr/alphabetical_browse/author_browse.db.\nMaybe you need to create your browse indexes?","trace":"java.lang.Exception: I couldn't find a browse index at: /home/dkatz/vufind3/solr/alphabetical_browse/author_browse.db.\nMaybe you need to create your browse indexes?\n\tat au.gov.nla.solr.handler.HeadingsDB.openDB(BrowseRequestHandler.java:72)\n\tat au.gov.nla.solr.handler.HeadingsDB.reopenIfUpdated(BrowseRequestHandler.java:127)\n\tat au.gov.nla.solr.handler.Browse.reopenDatabasesIfUpdated(BrowseRequestHandler.java:553)\n\tat au.gov.nla.solr.handler.BrowseRequestHandler.handleRequestBody(BrowseRequestHandler.java:752)\n\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:1817)\n\tat org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:639)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)\n\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)\n\tat org.eclipse.jetty.server.Server.handle(Server.java:365)\n\tat org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)\n\tat org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)\n\tat org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)\n\tat org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)\n\tat org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)\n\tat org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)\n\tat org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)\n\tat org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)\n\tat java.lang.Thread.run(Thread.java:679)\n","code":500}} diff --git a/module/VuFind/tests/fixtures/response/solr/solr4-parse-error b/module/VuFind/tests/fixtures/response/solr/solr4-parse-error new file mode 100644 index 0000000000000000000000000000000000000000..712af02a5a807f8d53cdcf4dc0cf63c4f1afdf54 --- /dev/null +++ b/module/VuFind/tests/fixtures/response/solr/solr4-parse-error @@ -0,0 +1,9 @@ +HTTP/1.1 400 Bad Request +Cache-Control: no-cache, no-store +Pragma: no-cache +Expires: Sat, 01 Jan 2000 01:00:00 GMT +Last-Modified: Wed, 29 May 2013 15:31:45 GMT +ETag: "13ef0ea94ef" +Content-Type: application/json; charset=UTF-8 + +{"responseHeader":{"status":400,"QTime":2,"params":{"spellcheck":"true","facet":"true","sort":"score desc","facet.mincount":"1","spellcheck.q":"~~~","facet.limit":"30","hl.simple.pre":"{{{{START_HILITE}}}}","json.nl":"arrarr","hl.fl":"*","wt":"json","hl":"true","rows":"20","fl":"*,score","start":"0","facet.sort":"count","q":"((title_short:(\"~~~\")^750 OR title_full_unstemmed:(\"~~~\")^600 OR title_full_unstemmed:(~~~)^500 OR title_full:(\"~~~\")^400 OR title:(\"~~~\")^300 OR title:(~~~)^250 OR title_alt:(~~~)^200 OR title_new:(~~~)^100)^50 OR series:(~~~)^50 OR series2:(~~~)^30 OR author:(\"~~~\")^300 OR author:(~~~)^250 OR author_fuller:(\"~~~\")^150 OR author_fuller:(~~~)^125 OR author2:(~~~)^50 OR author_additional:(~~~)^50 OR contents:(~~~)^10 OR topic_unstemmed:(\"~~~\")^550 OR topic_unstemmed:(~~~)^500 OR topic:(\"~~~\")^500 OR geographic:(\"~~~\")^300 OR genre:(\"~~~\")^300 OR allfields_unstemmed:(~~~)^10 OR fulltext_unstemmed:(~~~)^10 OR allfields:(~~~) OR fulltext:(~~~))","spellcheck.dictionary":"default","hl.simple.post":"{{{{END_HILITE}}}}","facet.field":["topic_facet","institution","building","format","callnumber-first","publishDate","authorStr","language","genre_facet","era_facet","geographic_facet"]}},"error":{"msg":"org.apache.solr.search.SyntaxError: Cannot parse '((title_short:(\"~~~\")^750 OR title_full_unstemmed:(\"~~~\")^600 OR title_full_unstemmed:(~~~)^500 OR title_full:(\"~~~\")^400 OR title:(\"~~~\")^300 OR title:(~~~)^250 OR title_alt:(~~~)^200 OR title_new:(~~~)^100)^50 OR series:(~~~)^50 OR series2:(~~~)^30 OR author:(\"~~~\")^300 OR author:(~~~)^250 OR author_fuller:(\"~~~\")^150 OR author_fuller:(~~~)^125 OR author2:(~~~)^50 OR author_additional:(~~~)^50 OR contents:(~~~)^10 OR topic_unstemmed:(\"~~~\")^550 OR topic_unstemmed:(~~~)^500 OR topic:(\"~~~\")^500 OR geographic:(\"~~~\")^300 OR genre:(\"~~~\")^300 OR allfields_unstemmed:(~~~)^10 OR fulltext_unstemmed:(~~~)^10 OR allfields:(~~~) OR fulltext:(~~~))': Encountered \" <FUZZY_SLOP> \"~ \"\" at line 1, column 91.\nWas expecting one of:\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS> ...\n <NUMBER> ...\n <TERM> ...\n \"*\" ...\n ","code":400}} diff --git a/module/VuFind/tests/fixtures/response/solr/solr4-undefined-field-error b/module/VuFind/tests/fixtures/response/solr/solr4-undefined-field-error new file mode 100644 index 0000000000000000000000000000000000000000..50eaf6d37a09f2dbc913afc28eea571afbe8c277 --- /dev/null +++ b/module/VuFind/tests/fixtures/response/solr/solr4-undefined-field-error @@ -0,0 +1,9 @@ +HTTP/1.1 400 Bad Request +Cache-Control: no-cache, no-store +Pragma: no-cache +Expires: Sat, 01 Jan 2000 01:00:00 GMT +Last-Modified: Wed, 29 May 2013 15:30:38 GMT +ETag: "13ef0e9905e" +Content-Type: application/json; charset=UTF-8 + +{"responseHeader":{"status":400,"QTime":2,"params":{"spellcheck":"true","facet":"true","sort":"score desc","facet.mincount":"1","spellcheck.q":"test:test","facet.limit":"30","hl.simple.pre":"{{{{START_HILITE}}}}","json.nl":"arrarr","hl.fl":"*","wt":"json","hl":"true","rows":"20","fl":"*,score","start":"0","facet.sort":"count","q":"test:test","spellcheck.dictionary":"default","hl.simple.post":"{{{{END_HILITE}}}}","facet.field":["topic_facet","institution","building","format","callnumber-first","publishDate","authorStr","language","genre_facet","era_facet","geographic_facet"]}},"error":{"msg":"undefined field test","code":400}} diff --git a/module/VuFind/tests/unit-tests/src/Search/Solr/V4/ErrorListenerTest.php b/module/VuFind/tests/unit-tests/src/Search/Solr/V4/ErrorListenerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..33dad92f8264c9b0a35a6373f35c10715d80dc64 --- /dev/null +++ b/module/VuFind/tests/unit-tests/src/Search/Solr/V4/ErrorListenerTest.php @@ -0,0 +1,110 @@ +<?php + +/** + * Unit tests for SOLR 3.x error listener. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2013. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * @category VuFind2 + * @package Search + * @author David Maus <maus@hab.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ + +namespace VuFindTest\Search\Solr\V4; + +use VuFind\Search\Solr\V4\ErrorListener; + +use VuFindSearch\Backend\Exception\HttpErrorException; + +use Zend\EventManager\Event; +use Zend\Http\Response; + +use PHPUnit_Framework_TestCase as TestCase; + +use RuntimeException; + +/** + * Unit tests for SOLR 3.x error listener. + * + * @category VuFind2 + * @package Search + * @author David Maus <maus@hab.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link http://vufind.org Main Site + */ +class ErrorListenerTest extends TestCase +{ + /** + * Detect parser error response. + * + * @return void + */ + public function testDetectParseError() + { + $response = $this->createResponse('solr4-parse-error'); + + $exception = HttpErrorException::createFromResponse($response); + $params = array('backend' => 'test'); + $event = new Event(null, $exception, $params); + $listener = new ErrorListener(array('test')); + $listener->onSearchError($event); + $this->assertTrue($exception->hasTag('VuFind\Search\ParserError')); + } + + /** + * Detect parser error response. + * + * @return void + */ + public function testDetectUndefinedFieldError() + { + $response = $this->createResponse('solr4-undefined-field-error'); + + $exception = HttpErrorException::createFromResponse($response); + $params = array('backend' => 'test'); + $event = new Event(null, $exception, $params); + $listener = new ErrorListener(array('test')); + $listener->onSearchError($event); + $this->assertTrue($exception->hasTag('VuFind\Search\ParserError')); + } + + /// Internal API + + /** + * Return response fixture + * + * @param string $name Name of fixture + * + * @return Response Response + */ + protected function createResponse($name) + { + $file = realpath( + \VUFIND_PHPUNIT_MODULE_PATH . '/fixtures/response/solr/' . $name + ); + if (!$file) { + throw new RuntimeException( + sprintf('Unable to resolve fixture to fixture file: %s', $name) + ); + } + $response = Response::fromString(file_get_contents($file)); + return $response; + } +} \ No newline at end of file diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Exception/RequestParseErrorException.php b/module/VuFindSearch/src/VuFindSearch/Backend/Exception/RequestParseErrorException.php deleted file mode 100644 index 2d61d981c6a592e8c4e89b16c2d33a143df1a00e..0000000000000000000000000000000000000000 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Exception/RequestParseErrorException.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -/** - * RequestParseErrorException. - * - * PHP version 5 - * - * Copyright (C) Villanova University 2010. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * as published by the Free Software Foundation. - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * @category VuFind2 - * @package Search - * @author David Maus <maus@hab.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://vufind.org - */ - -namespace VuFindSearch\Backend\Exception; - -/** - * RequestParseErrorException. - * - * Signals an error parsing the syntax of the user-supplied search criteria. - * - * @category VuFind2 - * @package Search - * @author David Maus <maus@hab.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License - * @link http://vufind.org - */ -class RequestParseErrorException extends RequestErrorException -{ -} diff --git a/themes/blueprint/images/feedbacktab/image-tab-cs.png b/themes/blueprint/images/feedbacktab/image-tab-cs.png new file mode 100644 index 0000000000000000000000000000000000000000..3da0e0582edbec84ef652363ce82637043f92db5 Binary files /dev/null and b/themes/blueprint/images/feedbacktab/image-tab-cs.png differ diff --git a/themes/blueprint/images/feedbacktab/image-tab-tr.png b/themes/blueprint/images/feedbacktab/image-tab-tr.png new file mode 100644 index 0000000000000000000000000000000000000000..61a6034869b80ec67ffa081418e2e37ce1a14e28 Binary files /dev/null and b/themes/blueprint/images/feedbacktab/image-tab-tr.png differ diff --git a/themes/blueprint/js/common.js b/themes/blueprint/js/common.js index 3e61cb74be57565a3ef0b116a087229b02b37e5a..7b9a9f1473ae33aff18f188a5dd8195828aae6fb 100644 --- a/themes/blueprint/js/common.js +++ b/themes/blueprint/js/common.js @@ -61,6 +61,7 @@ function extractParams(str) { function initAutocomplete() { $('input.autocomplete').each(function() { + var lastXhr = null; var params = extractParams($(this).attr('class')); var maxItems = params.maxItems > 0 ? params.maxItems : 10; var $autocomplete = $(this).autocomplete({ @@ -73,7 +74,11 @@ function initAutocomplete() { if (!searcher) { searcher = 'Solr'; } - $.ajax({ + // Abort previous access if one is defined + if (lastXhr !== null && typeof lastXhr["abort"] != "undefined") { + lastXhr.abort(); + } + lastXhr = $.ajax({ url: path + '/AJAX/JSON', data: {method:'getACSuggestions',type:type,q:request.term,searcher:searcher}, dataType:'json',