About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
legacy:vufind_1.x_developer_manual:building_a_search_object

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
legacy:vufind_1.x_developer_manual:building_a_search_object [2015/12/14 17:56] – ↷ Page moved from building_a_search_object to legacy:vufind_1.x_developer_manual:building_a_search_object demiankatzlegacy:vufind_1.x_developer_manual:building_a_search_object [2018/12/19 14:07] (current) demiankatz
Line 1: Line 1:
 ====== Search Objects ====== ====== Search Objects ======
  
-:!: // This documentation refers to VuFind 1.x; for newer versions, see the [[development:architecture:data_model_key_concepts|Data Model / Key Concepts]] page and [[development:howtos:connecting_a_new_external_data_source|Connecting a New External Data Source]] instead. //+// This outdated page has been deleted to prevent confusion; for current documentation, see the [[development:architecture:data_model_key_concepts|Data Model / Key Concepts]] and [[development:howtos:connecting_a_new_external_data_source|Connecting a New External Data Source]] pages. To view old content for historical interest, see the "Old Revisions" list below. //
  
-Starting with VuFind 1.0, most of VuFind's search controller behavior (collecting user parameters, handling facets, paging, etc.) was isolated to a family of classes known as Search Objects.  This reduces code redundancy when dealing with common problems, and it allows new search modules (using mechanisms other than Solr) to be built more quickly. 
- 
-Currently, separate Search Objects are used for Solr, Solr Authority, Summon and WorldCat searching.  A large amount of basic functionality is able to be shared between all of these modules. 
- 
-===== Current Architecture ===== 
- 
-Search Objects are constructed using the SearchObjectFactory class in web/sys/SearchObject/Factory.php.  Based on a search engine parameter, this factory class loads the appropriate SearchObject class (named SearchObject_[engine]) from a file in the web/sys/SearchObject directory (named [engine].php).  All Search Objects are extensions of an abstract SearchObject_Base class found in web/sys/SearchObject/Base.php. 
- 
-===== Building a New Search Object ===== 
- 
-To implement a new search feature, you need to do a few things: 
- 
-  * Implement a new SearchObject class that extends SearchObject_Base.  At the very minimum, be sure to implement all of SearchObject_Base's abstract methods. 
-  * Build a new module to call the new SearchObject class.  You may want to use web/services/Summon/Search.php or web/services/WorldCat/Search.php as a template. 
-  * Edit the deminify method of the SearchObjectFactory class to recognize your new SearchObject type.  This is necessary in order to restore compressed SearchObjects that have been stored in the database. 
-  * If your SearchObject contains new properties that need to be restored after compressed storage in the database, you may need to modify the minSO class in web/sys/SearchObject/Base.php to account for them.  If possible, avoid the creation of new properties in order to keep things simple! 
-  * Test that searches generated by your new SearchObject show up correctly in the history at %%http://[your_vufind_server]/vufind/Search/History%%.  This is the main area where multiple SearchObjects need to coexist peacefully. 
- 
- 
-===== Future Developments ===== 
- 
-The Search Object architecture is still a work in progress -- this is an area of code likely to see further refactoring in the future as more of the interface is standardized and complexity is reduced.  If you develop a new Search Object, you should expect to do some work from time to time to keep it in line with the trunk code. 
- 
-A few enhancements are desirable in the future; these are some of the reasons that future changes are expected: 
- 
-  * Some of the SearchObject classes (particular the Solr one) have some complex special cases that should be simplified. 
-  * For use in more contexts, it may be desirable to make the SearchObject classes less directly tied to particular request parameters. 
-  * The overall VuFind interface needs a better mechanism for allowing access to new search modules.  Right now, each module (Search, Summon, WorldCat) stands alone...  but it would be better to have a way to guide users between different kinds of searches when appropriate.  This may or may not have an impact on the SearchObjects themselves. 
-  * Search actions (the controllers that actually instantiate and call the SearchObject) are very similar across modules -- it may be desirable to find a way to share more of this logic. 
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
legacy/vufind_1.x_developer_manual/building_a_search_object.txt · Last modified: 2018/12/19 14:07 by demiankatz