Download presentation
Presentation is loading. Please wait.
Published bySebastian Lloyd Modified over 11 years ago
1
EIONET Training Searching and categorizing content Miruna Bădescu Finsiel Romania Copenhagen, 27 October 2003
2
Benefits of using ZCatalog n Searches are fast extremely quick searches without consuming much memory. n Searches are robust. The ZCatalog supports boolean search terms, proximity searches, synonyms and stopwords. n Indexing is wildly flexible. A ZCatalog can catalog custom properties and track unique values. n Usable outside of Zope. The Python Catalog can be used in any Python program; all it requires is the Z object database and the indexing machinery from Zope. n Transactional. An indexing operation is part of a Zope transaction. A ZCatalog can be altered privately in a Version, meaning no one else can see the changes to the index. n Cache-friendly. Only the part of the index that is needed is loaded into memory. Alternatively, an un-needed part of the index can be removed from memory. n Results are lazy. A search that returns a tremendous number of matches won't return a large result set.
3
Index types and metadata in the Catalog n A Field Index looks at the entire property value as a single value. n A TextIndex breaks the property up into words n Keyword Indexes allow you to index a sequence of "keywords" or "key phrases" as a single property of an object. n Path Indexes index the physical path of a sequence of objects. A Path Index will return all objects that match a partital path specified in a search query. n Metadata defines what per object meta data the Catalog will store
4
Prerequisites n Create a ZCatalog object in the ROOT, named Catalog n In the Catalog, go to "Indexes" tab and create the following indexes: u PrincipiaSearchSource, TextIndex u bobobase_modification_time, FieldIndex u id, FieldIndex u meta_type, FieldIndex u path, PathIndex u title, TextIndex n Go to "Metadata" tab and create the following metadata elements: u bobobase_modification_time u id u meta_type u summary u title
5
Prerequisites n Go to Find Objects tab, select objects type you want to catalog and click on the Find and Catalog button n You will be redirected to Catalog tab where is a list with all cataloged objects n Anytime you want to update/clear the catalog object, go to Advanced tab n Create some DTML Document and DTML Method objects for testing purposes (one or more should have the title test; this will be used later in the exercises) n Finally, go to Find Objects tab and select the DTML Method and DTML Document in the Find objects of type property and then click Find and Catalog button
6
Simple search by meta_type Search all DTML Methods from this site using the Catalog object (located in ROOT) and returns the list of results n Create a folder Work in the ROOT and go there n Create a DTML Method named search n Replace the content of the search method, with the following: Note: data_record_id_ is the unique integer identifier of the cataloged object
7
Search by meta_type and title Search all DTML Methods and DTML Document that have the title test using the Catalog and returns the list of results sorted by id n Go to the Work folder n Replace the content of the search method, with the following:. Note: n sequence-number is the index of the current item (starting with 1) n sort=string sorts the sequence by the given attribute name
8
Search by meta_type and path Search all DTML Methods and DTML Document from the Work folder the Catalog and return the list of results n Go to the Work folder n Add some DTML Method and DTML Document objects in the Work folder and reindex the Catalog (go to the Find Objects tab) n Replace the content of the search method, with the following :., Note: n absolute_url(1) is the relative path of the object n title_or_id returns the title if is the object has a non empty title, otherwise returns the id
9
Search by object modification time Search all objects from the site modified in the last 2 days n Go to the Work folder n Replace the content of the search method, with the following : Note: bobobase_modification_time_usage returns objects whose date is equal to or greater than the search value
10
Search site with catalog Search all objects from the site using the query from a search form n Go to the ROOT and add a DTML Method search and replace the content with : You must enter a query! Search results:. No results found.
11
Search site with catalog Search all objects from the site using the query from a search form n Modify the standard_html_header method : Search in all categories Cars Trucks
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.