cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene search working on Node Browser but not from scheduled task

cyruspy
Champ in-the-making
Champ in-the-making
Hi!, I'm trying to run a search from a scheduled. Execution of the following query works from Node Browser:


+PATH:"/app:company_home/st:sites/*/cm:calendar//*" AND +@ia\:fromDate:[NOW TO MAX]


This is part of the scheduled task definition:


        <property name="queryLanguage">
            <value>lucene</value>
        </property>
        <property name="stores">
            <list>
                <value>workspace://SpacesStore</value>
            </list>
        </property>
        <property name="queryTemplate">
            <!–<value>+@ia\:fromDate:\$\{luceneDateRange(now, \"P10D\")\} AND +PATH:"/app:company_home/st:sites/cm:prova/cm:calendar//*"</value>–>
         <value>+PATH:"/app:company_home/st:sites//*/cm:calendar//*" AND +@ia\:fromDate:[NOW TO MAX]</value>

        </property>



From de debug logs all I can see is:


03:12:00,004 DEBUG [httpclient.wire.content] >> "{"textAttributes":[],"allAttributes":[],"templates":[],"authorities":["GROUP_EVERYONE","ROLE_AUTHENTICATED","root"],"tenants":[""],"query":"+PATH:\"/app:company_home/st:sites//*/cm:calendar//*\" AND +@ia\\:fromDate:[NOW TO MAX]","locales":["en_US"],"defaultNamespace":"http://www.alfresco.org/model/content/1.0','defaultFTSFieldOperator':'OR','defaultFTSOperator':'OR"}"
03:12:00,004 DEBUG [org.apache.commons.httpclient.methods.EntityEnclosingMethod] Request body sent
03:12:00,016 DEBUG [httpclient.wire.header] << "HTTP/1.1 200 OK[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.header] << "HTTP/1.1 200 OK[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.header] << "Server: Apache-Coyote/1.1[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.header] << "Content-Type: text/plain;charset=UTF-8[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.header] << "Content-Length: 103[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.header] << "Date: Wed, 27 Feb 2013 06:12:00 GMT[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.header] << "[\r][\n]"
03:12:00,016 DEBUG [httpclient.wire.content] << "{"responseHeader":{"status":0,"QTime":10},"response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[]}}"


Any ideas of what's going on?
7 REPLIES 7

mitpatoliya
Star Collaborator
Star Collaborator
What happens if you use this?

   <value>+PATH:"/app:company_home/st:sites//*/cm:calendar//*" +@ia\:fromDate:\$\{luceneDateRange(yesterday, "-P10Y")\}</value>

cyruspy
Champ in-the-making
Champ in-the-making
Thanks for the quick answer!

It seems to be working:


06:40:00,147 DEBUG [httpclient.wire.content] >> "{"textAttributes":[],"allAttributes":[],"templates":[],"authorities":["GROUP_EVERYONE","ROLE_AUTHENTICATED","root"],"tenants":[""],"query":"+PATH:\"/app:company_home/st:sites//*/cm:calendar//*\" +@ia\\:fromDate:\\$\\{luceneDateRange(yesterday, \"-P10Y\")\\}","locales":["en_US"],"defaultNamespace":"http://www.alfresco.org/model/content/1.0','defaultFTSFieldOperator':'OR','defaultFTSOperator':'OR"}"
06:40:00,148 DEBUG [java.sql.ResultSet] <==    Columns: id, commit_time_ms, acl_count
06:40:00,148 DEBUG [org.mybatis.spring.SqlSessionUtils] Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@71dddd81]
06:40:00,148 DEBUG [java.sql.ResultSet] <==        Row: 262, 1361955760382, 0
06:40:00,148 DEBUG [java.sql.ResultSet] <==        Row: 263, 1361956566137, 0
06:40:00,148 DEBUG [java.sql.ResultSet] <==        Row: 264, 1361956935440, 0
06:40:00,148 DEBUG [java.sql.ResultSet] <==        Row: 265, 1361957947932, 2




Although I only saw one execution with results (job schedule every one minute for testing), maybe it was a coincidense (too much data un debug mode).


06:41:00,006 DEBUG [httpclient.wire.content] >> "{"textAttributes":[],"allAttributes":[],"templates":[],"authorities":["GROUP_EVERYONE","ROLE_AUTHENTICATED","root"],"tenants":[""],"query":"+PATH:\"/app:company_home/st:sites//*/cm:calendar//*\" +@ia\\:fromDate:\\$\\{luceneDateRange(yesterday, \"-P10Y\")\\}","locales":["en_US"],"defaultNamespace":"http://www.alfresco.org/model/content/1.0','defaultFTSFieldOperator':'OR','defaultFTSOperator':'OR"}"
06:41:00,006 DEBUG [org.apache.commons.httpclient.methods.EntityEnclosingMethod] Request body sent
06:41:00,019 DEBUG [httpclient.wire.header] << "HTTP/1.1 200 OK[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.header] << "HTTP/1.1 200 OK[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.header] << "Server: Apache-Coyote/1.1[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.header] << "Content-Type: text/plain;charset=UTF-8[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.header] << "Content-Length: 103[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.header] << "Date: Wed, 27 Feb 2013 09:41:00 GMT[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.header] << "[\r][\n]"
06:41:00,019 DEBUG [httpclient.wire.content] << "{"responseHeader":{"status":0,"QTime":11},"response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[]}}"



I'm trying to implement calendar event reminders as shown here:

https://forums.alfresco.com/es/node/31092

Can you explain me what could be wrong with the original query and why your suggestion seems to work only once?

mitpatoliya
Star Collaborator
Star Collaborator
In original query you have not used this $\{luceneDateRange(
also you should not use "AND" and +  operator both.
I did not get your next problem also.

cyruspy
Champ in-the-making
Champ in-the-making
Well, I'm not sure, but apparently it's not working. There's too much info in the debug logs, is there any way to get only the output of this job to better troubleshoot this?

I'm not sure the info I see relates to my job.

mitpatoliya
Star Collaborator
Star Collaborator
you can increase the time interval.
or there is one more way to do it create script file and put all your logic inside that and call that script in the schedules job.

cyruspy
Champ in-the-making
Champ in-the-making
This is what I get now:

<blockcode>
2013-03-16 17:42:00,167  DEBUG [httpclient.wire.content] [DefaultScheduler_Worker-4] >> "{"textAttributes":[],"allAttributes":[],"templates":[],"authorities":["GROUP_EVERYONE","ROLE_AUTHENTICATED","root"],"tenants":[""],"query":"+PATH:\"/app:company_home/st:sites//*/cm:calendar//*\" +@ia\\:fromDate:\\$\\{luceneDateRange(yesterday, \"-P10Y\")\\}","locales":["es_ES"],"defaultNamespace":"http://www.alfresco.org/model/content/1.0','defaultFTSFieldOperator':'OR','defaultFTSOperator':'OR"}"
2013-03-16 17:42:01,655  DEBUG [httpclient.wire.content] [DefaultScheduler_Worker-4] << "{"responseHeader":{"status":0,"QTime":1367},"response":{"numFound":0,"start":0,"maxScore":0.0,"docs":[]}}"
</blockcode>

As I understand, there are no results (events where inserted in the calendar)

cyruspy
Champ in-the-making
Champ in-the-making
sorry for the delay, I'm cannot find a way to enable debugging for just this script execution. By putting all the logic there you mean not using scheduled-action-services-context.xml ?