Why am I getting this error? If I remove the Addressess__r references in the WHERE clause it works fine.
Error: Didn't understand relationship 'Addresses_r' in field path. If you are attempting to use a custom relationship, be sure to append the '_r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
SELECT ParentId,
Id,
Name,
(SELECT Id,
Name,
Contact_Name__c,
Contact__r.Name,
Contact__r.Email
FROM Position__r
WHERE RecordType.Name = 'Collegiate Ministry'
AND Position_Title__c = 'Campus Minister'),
(SELECT Address_Line1__c,
Address_Line2__c,
City__c,
State__c,
Zip_Postal_Code__c,
Country__c,
URL__c,
Email__c
FROM Addresses__r
WHERE RecordTypeId IN (:rtLoc.Id, :rtMail.Id))
FROM Account
WHERE
Name LIKE :term + '%'
OR
Position__r.Contact__r.Name LIKE :term + '%'
OR
Addresses__r.City__c LIKE :term + '%'
OR
Addresses__r.State__c LIKE :term + '%'