select contact_search__log(:search_id,:user_id)
select title
from acs_objects
where object_id = :search_id
select contact_searches.*, acs_objects.title, acs_objects.package_id
from contact_searches, acs_objects
where contact_searches.search_id = :search_id
and contact_searches.search_id = acs_objects.object_id
select type,
var_list
from contact_search_conditions
where search_id = :search_id
select count(distinct party_id)
from parties left join cr_items on (parties.party_id = cr_items.item_id) left join cr_revisions on (cr_items.latest_revision = cr_revisions.revision_id ) , group_approved_member_map
where parties.party_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
[contact::search_clause -and -search_id $search_id -query $query -party_id "parties.party_id" -revision_id "revision_id" -limit_type_p "0"]
select count(distinct person_id)
from persons, cr_items, cr_revisions, group_approved_member_map
where persons.person_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
and persons.person_id = cr_items.item_id
and cr_items.latest_revision = cr_revisions.revision_id
[contact::search_clause -and -search_id $search_id -query $query -party_id "persons.person_id" -revision_id "revision_id" -limit_type_p "0"]
select count(distinct organization_id)
from organizations, cr_items, cr_revisions, group_approved_member_map
where organizations.organization_id = group_approved_member_map.member_id
and group_approved_member_map.group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]])
and organizations.organization_id = cr_items.item_id
and cr_items.latest_revision = cr_revisions.revision_id
[contact::search_clause -and -search_id $search_id -query $query -party_id "organizations.organization_id" -revision_id "revision_id" -limit_type_p "0"]
select object_type
from contact_searches
where search_id = :search_id
select count(object_id_one)
from acs_rels
where rel_type = 'contact_rels_employment'
select 1
from cr_items
where item_id = $party_id
and item_id in ( select member_id from group_approved_member_map where group_id in ([template::util::tcl_to_sql_list [contacts::default_groups -package_id $package_id]]))
[contact::search_clause -and -search_id $search_id -party_id "cr_items.item_id" -revision_id "cr_items.live_revision"]
select title,
owner_id,
all_or_any,
object_type
from contact_searches
where search_id = :search_id
select type,
var_list
from contact_search_conditions
where search_id = :search_id