Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

keyword_count

Summary

Fetches the number of nodes that use certain keywords. Only nodes that are main locations for content objects are counted.

Usage

fetch( 'content', 'keyword_count',
 hash( 'alphabet',           alphabet,
     [ 'strict_matching',    strict_matching,    ]
     [ 'classid',            classid,            ]
     [ 'owner',              owner,              ]
     [ 'parent_node_id',     parent_node_id,     ]
     [ 'include_duplicates', include_duplicates  ] ) )

Parameters

NameTypeDescriptionRequired
alphabet string The sequence that should be matched. Yes.
strict_matching boolean Enables or disables exact matching. If FALSE (or omitted), the function will look for keywords that start with the specified sequence. No.
classid integer Filtering: the ID number of the class. No.
owner integer Filtering by owner: the ID number of the object representing the user. No.
parent_node_id integer The ID number of the parent node. No.
include_duplicates boolean Makes it possible to avoid counting duplicates (different keywords but same nodes). If TRUE (or omitted), duplicates are allowed. No.

Returns

The number of matching nodes (as an integer).

Description

This fetch function operates in almost the same way as the "keyword" fetch function. However, instead of returning the actual nodes along with the matching keywords, it returns the count of the nodes. The "keyword_count" function takes the same parameters as the "keyword" function with some exceptions (for example sorting is not supported). Refer to the documentation of the "keyword" function for a detailed description of the parameters.

Examples

Example 1

{def $count=fetch( 'content', 'keyword_count',
                   hash( 'alphabet', 'computer' ) )}
 
There are {$count} number of nodes using keywords starting with "computer".

Outputs the number of nodes that encapsulate objects which use keywords starting with "computer".

Balazs Halasy (06/02/2004 12:07 pm)

Julia Shymova (29/01/2008 10:51 am)

Balazs Halasy, Julia Shymova


Comments

There are no comments.