[opencms-dev] retreiving content resources by property (secondtime)

Jonathan Woods jonathan.woods at scintillance.com
Thu Jan 19 06:30:53 CET 2006


Osama -

You can also get OpenCms's Lucene to index your XML documents, and then you
can search more powerfully than just on properties.  For example, you could
combine searches across multiple fields (elements), and include regexp
search criteria, date range criteria etc.

I'm going to be doing this soon, so I may be in touch...!

Jon 

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Andreas Zahner
Sent: 18 January 2006 13:11
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] retreiving content resources by property
(secondtime)

Osama,

try the following method from the CmsObject:

    /**
     * Reads all resources that have a value (containing the specified
value) set 
     * for the specified property in the given path.<p>
     * 
     * Both individual and shared properties of a resource are checked.<p>
     *
     * @param path the folder to get the resources with the property from
     * @param propertyDefinition the name of the property to check for
     * @param value the string to search in the value of the property
     * 
     * @return all <code>{@link CmsResource}</code> objects 
     *          that have a value set for the specified property in the
given path.
     * 
     * @throws CmsException if something goes wrong
     */
    public List readResourcesWithProperty(String path, String
propertyDefinition, String value) throws CmsException;

To get an initialized CmsObject on your JSP, use the method of the
CmsJspActionElement: getCmsObject() or use it in your customized collector
code;

Regards,

Andreas Zahner
Alkacon Software - The OpenCms Experts
http://www.alkacon.com 

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Osama Abu Elsorour
Sent: Wednesday, January 18, 2006 12:43 PM
To: opencms-dev at opencms.org
Subject: [opencms-dev] retreiving content resources by property (second
time)




Hello all

We are building an OpenCMS based news website whereby articles will be
displayed. An article would typically contain a title, author, date,
section, etc. This article is implemented in XML content.

The problem is the following: if I want, for example, in a full article view
to get the "latest articles written by this author", how can this be done? 

The solution I thought of was by building a custom collector for my articles
that can filter them by a custom property called "author-name" for example.

I have worked with other CMS software and this capability comes out of the
box: you can query the system for pieces of content based on metadata
(a.k.a. properties) values. For example: get me all articles with property
author-name=abc (or even use wildcards)

Is this already available? Or do I have to build the collector? If it is
available, how do I do it?

Thanks a lot.



_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev


_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev


_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev





More information about the opencms-dev mailing list