search

Summary

Does a search in published content objects

Usage

fetch( content, search,
       hash( text, text,
             [ offset, offset, ]
             [ limit, limit, ]
             [ section_id, id, ]
             [ subtree_array, array, ]
             [ publish_timestamp, time, ]
             [ publish_date, date, ]
             [ section_id, id, ]
             [ class_id, id, ]
             [ class_attribute_id, id, ]
             [ sort_by, array( 'modified', false() ) ] ) )

Parameters

NameTypeDescriptionRequired
text string The text to search for yes
subtree_array mixed An array node id's to search under no
offset integer Start returning from this offset no
limit integer Return maximum this number of objects no
publish_timestamp integer - no
publish_date integer - no
section_id integer Only search in this section. no
class_id integer Only search in this class. no
class_attribute_id integer Only search in this class attribute. no
sort_by mixed Sort the result. See description below. no

Returns

A hash array containing search information

Description

Will perform a search and return all hits wich the current user has read access to.

The return value is a hash array containing:

  • SearchResult - An array with eZContentObjectTreeNode objects which matched the search conditions.
  • SearchCount - The total number of content-nodes that matched the search conditions.
  • StopWordArray - An array with search words that were excluded from the search, each element is a new array.

The stop word element contains:

Examples

Fetch and list all Articles containing the word olympics.

{let�search=fetch(�content,�search,

�������������������hash(�text,�'olympics',

�������������������������class_id,�2�)�)}

����Search�text�matched�{$search.SearchCount}�matches.

����{section�var=node�loop=$search.SearchResult}

��������<a�href={$node.main_node.url_alias|ezurl}>{$node.name}</a><br�/>

����{/section}

{/let}

Comments

Log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
Template functions
Data fetching
    Class
    Content
       access
       bookmarks
       can_instantiate_class_list
       can_instantiate_classes
       class
       class_attribute
       class_attribute_list
       collected_info_collection
       collected_info_count
       collected_info_count_list
       contentobject_attributes
       draft_count
       draft_version_list
       keyword
       keyword_count
       list
       list_count
       locale_list
       navigation_parts
       node
       non_translation_list
       object
       object_by_attribute
       object_count_by_user_id
       pending_count
       pending_list
       recent
       same_classattribute_node
       search
       section_list
       tipafriend_top_list
       translation_list
       trash_count
       trash_object_list
       tree
       tree_count
       version
       version_count
       version_list
       view_top_list
    Collaboration
    Layout
    Notification
    Package
    Section
    Shop
    URL
    User
Modules
XML tags


Created

06/02/2004
1:12:23 pm
by Balazs Halasy

Last updated

07/01/2005
10:52:21 am
by Luc Chase

Authors

Balazs Halasy
B�rd Farstad
K�re K�hler H�vik
Jan Borsodi
Luc Chase



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.