Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search using proximity broken when using Omeka 2.3.1 #35

Closed
mjlassila opened this issue Nov 9, 2015 · 8 comments
Closed

Search using proximity broken when using Omeka 2.3.1 #35

mjlassila opened this issue Nov 9, 2015 · 8 comments

Comments

@mjlassila
Copy link
Contributor

Search using address proximity (in /items/browse) gives the following error in Omeka 2.3.1 when using the current version (master branch) of the plugin. In the admin map browse view (admin/geolocation/map/browse?) search works normally.

With Omeka 2.2.2 and the same version of plugin there's no error so it seems that the error is somehow related to recent changes in Omeka core.

exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column '    COS(RADIANS(60.631811)) *' in 'field list'' in /home/omeka/omeka-2.3/application/libraries/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/omeka/omeka-2.3/application/libraries/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('SELECT `items`....')
#1 /home/omeka/omeka-2.3/application/libraries/Zend/Db/Adapter/Mysqli.php(388): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'SELECT `items`....')
#2 /home/omeka/omeka-2.3/application/libraries/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Adapter_Mysqli->prepare('SELECT `items`....')
#3 [internal function]: Zend_Db_Adapter_Abstract->query(Object(Omeka_Db_Select), Array)
#4 /home/omeka/omeka-2.3/application/libraries/Omeka/Db.php(79): call_user_func_array(Array, Array)
#5 /home/omeka/omeka-2.3/application/libraries/Omeka/Db/Table.php(648): Omeka_Db->__call('query', Array)
#6 /home/omeka/omeka-2.3/application/libraries/Omeka/Db/Table.php(648): Omeka_Db->query(Object(Omeka_Db_Select), Array)
#7 /home/omeka/omeka-2.3/application/libraries/Omeka/Db/Table.php(281): Omeka_Db_Table->fetchObjects(Object(Omeka_Db_Select))
#8 [internal function]: Omeka_Db_Table->findBy(Array, 10, 1)
#9 /home/omeka/omeka-2.3/application/controllers/helpers/Db.php(59): call_user_func_array(Array, Array)
#10 /home/omeka/omeka-2.3/application/libraries/Omeka/Controller/AbstractActionController.php(128): Omeka_Controller_Action_Helper_Db->__call('findBy', Array)
#11 /home/omeka/omeka-2.3/application/libraries/Omeka/Controller/AbstractActionController.php(128): Omeka_Controller_Action_Helper_Db->findBy(Array, 10, 1)
#12 /home/omeka/omeka-2.3/application/controllers/ItemsController.php(183): Omeka_Controller_AbstractActionController->browseAction()
#13 /home/omeka/omeka-2.3/application/libraries/Zend/Controller/Action.php(516): ItemsController->browseAction()
#14 /home/omeka/omeka-2.3/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('browseAction')
#15 /home/omeka/omeka-2.3/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#16 /home/omeka/omeka-2.3/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#17 /home/omeka/omeka-2.3/application/libraries/Zend/Application.php(382): Zend_Application_Bootstrap_Bootstrap->run()
#18 /home/omeka/omeka-2.3/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#19 /home/omeka/omeka-2.3/index.php(23): Omeka_Application->run()
#20 {main}
@mjlassila
Copy link
Contributor Author

I went through recent Zend Framework changelogs and it seems that in Zend 1.12.8 there were relevant changes in Zend DB layer. (zendframework/zf1#418). I got this fixed by using Zend_Db_Expr when constructing SQL query for location search (https://github.com/mjlassila/plugin-Geolocation/blob/master/GeolocationPlugin.php#L291).

@zerocrates
Copy link
Member

Yeah, the changes to expression handling have bit some other plugins before, but nobody had reported it on this one yet.

What's curious to me here is that you report the search works fine from the map page. Does that include the proximity search, or just other searches?

@mjlassila
Copy link
Contributor Author

Tested this once more and actually the proximity search in admin/geolocation/map/browse doesn't work correctly. Searching doesn't give the database error, but at the same time the map doesn't display hits even though the page title indicates that there are matching items.

It seems really strange that the search works at all because admin map search uses the same code as the public search view 😕

@zerocrates
Copy link
Member

With your changed code are the results correct in the "regular" search, the map search, on admin and public?

If its the expression/parens problem, which it would make sense to be, then that change should fix the issue everywhere.

@mjlassila
Copy link
Contributor Author

Changed code fixes the problem everywhere. The reason I'm confused was that the unpatched code worked at all but nevertheless, now it works.

@zerocrates
Copy link
Member

Can you make a pull request containing your change?

@mjlassila
Copy link
Contributor Author

It seems impossible to make a pull request from a repo which is not a direct fork but here's a diff: https://github.com/mjlassila/plugin-Geolocation/commit/d37bb63f6c01e5eea25d2ebcab9f7c67992acd34.diff

@zerocrates
Copy link
Member

Okay, I pulled in your change from your repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants