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

Osama Abu Elsorour osama at wayout.net
Thu Jan 19 10:06:23 CET 2006


Thank you guys for your suggestions.

Andreas:
I have looked at your proposition and it seems feasible enough to use.
However, I would like to propose the following:
The Problems:
- This method looks on one property with a specific property with a specific
value. If I want to do a bit more complex lookups it will not help.
- Properties will have to be entered separately. Meaning that after the
editor fills his XML content form, he/she will have to edit the file
properties and add/edit the properties that will be used in the lookups.
Major inconvenience.

So I thought of doing the following (actually kinda started on it too):
- Build a custom XML type, call it XmlPropertyType for example
  - It represents a string, very similar to XmlString
  - It will also reflect any changes to it to a property with the same name
For example, if we add a form field called "Author" with type
XmlPropertyType, it will be saved normally in the XML file as a normal
string and in the same time will update a property called "Author" as well.
This way "Author" can be used in ContentShow and can be queried as property
without doing double the data entry work.
I know this might seem as an ugly redundancy in storage, but hear me out.

- Build a custom file collector that can handle complex content queries on
the properties. For example: "Author='Jon Smith' OR Section='World News/*'"
or the simpler ones such as "Author='Jon Smith'".
This way content may be queried in almost any possible way. Actually, if
done right, it can be a super set for all the file collectors since it can
handle almost any property query.

However, there is obviously a great deal of CPU and database work. Actually,
very painful work to do the first query.

So unless:
- OpenCms FlexCache can cache the results (through caching the JSP pages
that will perform the lookups)
- You give me the initial ok as a concept

This might not be a good idea.

Jon:
I really like your Lucene idea. I am not sure exactly how to do it. I will
do some homework on that and test it out. Of course this idea is far
superior to what I proposed since it will rid us of the "ugly redundancy"
and the extreme CPU punishment.

I will keep you updated on that and please do the same with me.

Thanks again.

-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Jonathan Woods
Sent: Thursday, January 19, 2006 7:31 AM
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] retreiving content resources by
property(secondtime)

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



_______________________________________________
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