There is OSGi JAVA Class running as service gets called through custom workflow Handler API.
Workflow gets executed and performs two JCR query using Query Builder API and it it takes Workflow session as parameter to execute JCR Query.
Query are like this QueryStarement : //element(*, dam:Asset)[(fn:name() = 'hksTestDAMUpload.pdf')],
It works perfectly in Non-Production environment including my desktop
On Production, 2nd query does not return any results, to find more information i enabled log for query execution and found SearchResult.getExecutionTimeMillis is returning 0ms.
Thought?
/Chandra
Solved! Go to Solution.
Views
Replies
Total Likes
If the execution time is reported as 0 ms, it doesn't mean anything. Most likely the query ran quite fast, so the plattform dependent timers (or the calculation itself) returned a difference of 0 ms.
Views
Replies
Total Likes
Please see this query debug information.
/////////////// same code query printed like this in lower environment where it works and all good :) ///////////////
ROOT=group: limit=1000, offset=0[
{group=group: or=true[
{01_nodename=nodename: nodename=sample.pdf}
]}
{path=path: path=/content/dam/abc}
]
///////////This log was taken on production it always returns 0 //////////////////////
ROOT=group: limit=1000, offset=0[
{group=group: or=true[
{01_nodename=nodename: nodename=sample.pdf}
]}
{path=path: path=[/content/dam/abc]}
]
This logs taken from production. so if you see path it is bringing extra [] that causes filter and after filter applied it become returns 0.
: /etc/workflow/instances/2014-09-25/model_1646252587480881:/content/dam/abc/admin/pdf-archive/document.zip] com.day.cq.search.impl.builder.QueryImpl xpath query took 0 ms
25.09.2014 15:09:28.770 *DEBUG* [JobHandler: /etc/workflow/instances/2014-09-25/model_1646252587480881:/content/dam/abc/admin/pdf-archive/document.zip] com.day.cq.search.impl.builder.QueryImpl >> xpath query returned 3 results
25.09.2014 15:09:28.770 *DEBUG* [JobHandler: /etc/workflow/instances/2014-09-25/model_1646252587480881:/content/dam/abc/admin/pdf-archive/document.zip] com.day.cq.search.impl.builder.QueryImpl filtering predicates: {path=path: path=[/content/dam/abc]}
25.09.2014 15:09:28.770 *DEBUG* [JobHandler: /etc/workflow/instances/2014-09-25/model_1646252587480881:/content/dam/abc/admin/pdf-archive/document.zip] com.day.cq.search.impl.builder.QueryImpl filtering took 0 ms
Views
Replies
Total Likes
If the execution time is reported as 0 ms, it doesn't mean anything. Most likely the query ran quite fast, so the plattform dependent timers (or the calculation itself) returned a difference of 0 ms.
Views
Replies
Total Likes
That seems not right. We have 50K contents in JCR and Other pre-prod environment takes 2ms minimum ..) 0ms means something causing query execution fails that’s why its comes 0ms.
Here is code snippets
Map<String, String> map = new HashMap<String, String>();
map.put("path", this.damPath);
LOGGER.debug("reading all input Asset Node" );
map.put("group.p.or", "true");
for (int i = 0; i < searchResult.size(); i++) {
map.put("group." + i + 1 + "_nodename", searchResult.get(i));
}
map.put("p.offset", "0");
map.put("p.limit", "1000");
final Query query = queryBuilder.createQuery(PredicateGroup.create(map),session);
final SearchResult result = query.getResult();
if(LOGGER.isDebugEnabled()){
LOGGER.debug("<< Total record found findAssetDAM >> "+ result.getTotalMatches());
LOGGER.debug("QueryStarement : "+result.getQueryStatement()+", execution time : "+result.getExecutionTimeMillis()+"ms, total results: "+result.getTotalMatches());
}
Views
Replies
Total Likes
damapth property was set as cardinality=-1234234 so that's why [] Parenthesis was coming for String object.
Now question is why it was working in Lower environment and not in Production here is logic?
Felix save OSGI configuration on file system and in JCR CRX under /apps/system node. When Code was deployed , Config value was never updated from Felix UI so it never got updated values saved in CRX and File system. So even cardinality is in negative OSGI framework return that property as String and always works but in Production I saved manually just to be double sure and that caused issue.
How it is fixed?
Deleted node from jcr /apps/system and OSGI config for the service and it works. There is future fix that cardinality has to be non-negative to be returned as String not as vector.
Hope it will help others.
Regards,
Chandra Gupta
Views
Replies
Total Likes
Hi,
please check your logs, the querybuilder logs by default some useful information, also the generated query string. You can also execute this query string using CRXDE Lite and compare response times.
Jörg
Views
Replies
Total Likes
Thanks for reply i tried everything i could ..
Enabled log, ran query in CRX Query console and it returns data :) .
Views
Replies
Total Likes
Views
Likes
Replies