You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Thorsten Scherler <th...@juntadeandalucia.es> on 2009/07/16 10:17:11 UTC

Content filters

Hi all, 

I need to implement some ContentFiltering widgets for a lenya
publication. The widgets are basically selects over certain MetaData
fields on specific resource types.

Our publication is focused on events of a certain region. You can add
events to certain categories and later on edit their content. This
events use meta data that allows filtering like place, start date, end
date, etc.

One specific widget is e.g. cities. The containing options are all
cities of the different events (the duplicates removed). Clicking on the
filter will result in a listing of all events for that city.

What is the preferred method in lenya to get all documents of a certain
resource type? 

How can I control the caching of the this call, since I can use a cached
version of the listing until one of the documents get edit?

I will add the result of this thread to the working with documents
section.

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Content filters

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2009-07-16 at 10:48 +0200, Andreas Hartmann wrote:
> Andreas Hartmann schrieb:
> > Hi Thorsten,
> > 
> > Thorsten Scherler schrieb:
> >> I need to implement some ContentFiltering widgets for a lenya
> >> publication. The widgets are basically selects over certain MetaData
> >> fields on specific resource types.
> >>
> >> Our publication is focused on events of a certain region. You can add
> >> events to certain categories and later on edit their content. This
> >> events use meta data that allows filtering like place, start date, end
> >> date, etc.
> >>
> >> One specific widget is e.g. cities. The containing options are all
> >> cities of the different events (the duplicates removed). Clicking on the
> >> filter will result in a listing of all events for that city.
> >>
> >> What is the preferred method in lenya to get all documents of a certain
> >> resource type?
> > 
> > I guess the most performant way is to use Lucene. The query would be:
> > 
> > {http://apache.org/lenya/metadata/document/1.0}resourceType:foobar
> 
> Some more hints:
> 
> * Special characters in the query have to be escaped. There's more info 
> in the query parser syntax docs of Lucene.
> 
> * You find an example in the tagcloud module in the contributions area. 
> This is basically the same task: Find all documents with a particular 
> meta data value.
> 
> * Of course queries can be combined:
> 
>    +{…}resourceType:foo +{…}city:Sevilla
> 

Nice I will have a closer look on the tagcloud. Cheers mate.

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Content filters

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
> Hi Thorsten,
> 
> Thorsten Scherler schrieb:
>> I need to implement some ContentFiltering widgets for a lenya
>> publication. The widgets are basically selects over certain MetaData
>> fields on specific resource types.
>>
>> Our publication is focused on events of a certain region. You can add
>> events to certain categories and later on edit their content. This
>> events use meta data that allows filtering like place, start date, end
>> date, etc.
>>
>> One specific widget is e.g. cities. The containing options are all
>> cities of the different events (the duplicates removed). Clicking on the
>> filter will result in a listing of all events for that city.
>>
>> What is the preferred method in lenya to get all documents of a certain
>> resource type?
> 
> I guess the most performant way is to use Lucene. The query would be:
> 
> {http://apache.org/lenya/metadata/document/1.0}resourceType:foobar

Some more hints:

* Special characters in the query have to be escaped. There's more info 
in the query parser syntax docs of Lucene.

* You find an example in the tagcloud module in the contributions area. 
This is basically the same task: Find all documents with a particular 
meta data value.

* Of course queries can be combined:

   +{…}resourceType:foo +{…}city:Sevilla


-- Andreas



-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Content filters

Posted by Andreas Hartmann <an...@apache.org>.
Hi Thorsten,

Thorsten Scherler schrieb:
> I need to implement some ContentFiltering widgets for a lenya
> publication. The widgets are basically selects over certain MetaData
> fields on specific resource types.
> 
> Our publication is focused on events of a certain region. You can add
> events to certain categories and later on edit their content. This
> events use meta data that allows filtering like place, start date, end
> date, etc.
> 
> One specific widget is e.g. cities. The containing options are all
> cities of the different events (the duplicates removed). Clicking on the
> filter will result in a listing of all events for that city.
> 
> What is the preferred method in lenya to get all documents of a certain
> resource type?

I guess the most performant way is to use Lucene. The query would be:

{http://apache.org/lenya/metadata/document/1.0}resourceType:foobar

See also

https://lenya.zones.apache.org/cms/docu/authoring/docu20/reference/metadata.html#N100BF

A while ago I started to implement a convenient API to do such queries, 
see thread "API for document search" on the users list. Maybe we can 
discuss this again?

> How can I control the caching of the this call, since I can use a cached
> version of the listing until one of the documents get edit?

The Lucene query should be pretty fast, so caching the resulting list 
might not be necessary.

If you don't want to use Lucene, you could write a custom generator that 
stores an index of the relevant meta data and uses the last modification 
date for the cache validity. The generator also has to check the 
sitetree to see if documents have been added or removed. This is a 
rather complex task, but we used it for a customer in Lenya 1.2 and up 
to now it works very well (in combination with mod_cache, though).

HTH,

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org