Foren

DynamicQuery & "structured' JournalArticle fields

Edouard Perr, geändert vor 11 Jahren.

DynamicQuery & "structured' JournalArticle fields

Junior Member Beiträge: 30 Beitrittsdatum: 20.08.12 Neueste Beiträge
Hi there,

I would like to use DynamicQuery to fetch some journal articles (which have a defined structure) regarding a custom field. For example, I have a structure which define a field topic, and I wish to fetch all articles in which topic = "technology".

I know how to get the content of a journal article and parse it to retrieve this custom field with SAXreader, but I think it not a solution to fetch all articles and parse them successively to check if the topic is "technology" or not.

Thus I wondering how I can do that within DynamicQuery ?
I wish to use it in a velocity template.

Thank you.
Edouard
Edouard Perr, geändert vor 11 Jahren.

RE: DynamicQuery & "structured' JournalArticle fields

Junior Member Beiträge: 30 Beitrittsdatum: 20.08.12 Neueste Beiträge
Any ideas ?
I suppose it is the kind of operation we can make!!
There are some search capabilities on each fields in the template, how to use it ? With Lucene?

I looked at IndexerRegistryUtil, BooleanQueryFactoryUtil and SearchContextFactory.
I think it is the right way but I do not manage to understand it.

Please help!
thumbnail
Vitaliy Koshelenko, geändert vor 11 Jahren.

RE: DynamicQuery & "structured' JournalArticle fields

Expert Beiträge: 319 Beitrittsdatum: 25.03.11 Neueste Beiträge
Hi, Edouard!

I have been also searching for such a solution, but didn't found it. I used DynamicQuery with "like" clause for this purpose:

        DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(JournalArticle.class, cl)
                .add(PropertyFactoryUtil.forName("structureId").eq(structureId)
                .add(PropertyFactoryUtil.forName("content").like("%<dynamic-content>technology</dynamic-content>%");


..so, the query will return articles with specified structureId, and those, which have "technology" value of custom field.

Vitaliy
Edouard Perr, geändert vor 11 Jahren.

RE: DynamicQuery & "structured' JournalArticle fields

Junior Member Beiträge: 30 Beitrittsdatum: 20.08.12 Neueste Beiträge
Hi Vitaliy,

Thank you for your answer and the trick!
I will do that until I find a better and cleaner solution. I will discuss with my teamworkers and I will post a solution (if we find it!) here. ;)
Gwowen Fu, geändert vor 11 Jahren.

RE: DynamicQuery & "structured' JournalArticle fields

Expert Beiträge: 315 Beitrittsdatum: 27.12.10 Neueste Beiträge
You can also use Faceted Search API to search structure field. Detailed info at

http://www.liferay.com/web/raymond.auge/blog/-/blogs/12917352
thumbnail
Vitaliy Koshelenko, geändert vor 11 Jahren.

RE: DynamicQuery & "structured' JournalArticle fields

Expert Beiträge: 319 Beitrittsdatum: 25.03.11 Neueste Beiträge
Let me know if you found a better solution, please emoticon
Patrik Holecka, geändert vor 9 Jahren.

RE: DynamicQuery & "structured' JournalArticle fields

Junior Member Beiträge: 46 Beitrittsdatum: 21.10.13 Neueste Beiträge
Hi,
did you find solution?