Notesdatabase.search not working on a server

I’ve written an agent that performs a search in a database. When I run the agent on the server, it finds no documents, If I run the agent on a local replica, it works fine and puts some documents in the notesdocumentcollection. Does anyone has an idea?

Dries

code:

country = ReplaceSubString(docKeyword.Keywords(0), “Preventive Maintenance Ticket Creation~”, “”)

		strSearch= {Form = "Contract" & ReplicationCountry =  "} & country  & {" & ((@Text(PMDate_1) = "} &  ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_1) = ""} & ") |" 

		strSearch = strSearch & "(" & {@Text(PMDate_2) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_2) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_3) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_3) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_4) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_4) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_5) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_5) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_6) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_6) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_7) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_7) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_8) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_8) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_9) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_9) = ""} & ")|" 

		strSearch = strSearch & "(" & {@Text(PMDate_10) = "} & ndtRenewalDate.DateOnly & {" & @Text(PMDateDone_10) = ""} & "))" 	

		

	'Doing the search and creating a collection of matching documents

		Set collection = db.Search(strSearch, Nothing, 0)

		Msgbox "collection: " & collection.count

Subject: What about…

My first thoughts would be security or a search limitation.

Any errors in the server log?

Are you using readers fields, and is “Enforce a consistent Access Control List across all replicas” checked?