function find_groups_by_tag_title($options, $tag) { $options['by_tag'] = true; $options['by_title'] = false; $resByTag = zhgroups_find_groups($options, $tag); $entitiesByTag = $resByTag["entities"]; $countByTag = $resByTag["count"]; $options['by_tag'] = false; $options['by_title'] = true; $resByTitle = zhgroups_find_groups($options, $tag); $entitiesByTitle = $resByTitle["entities"]; $countByTitle = $resByTitle["count"]; if ($countByTag == 0) { return $resByTitle; } if ($countByTitle == 0) { return $resByTag; } $options['by_tag'] = true; $options['by_title'] = true; $options['count_only'] = true; $resIntersect = zhgroups_find_groups($options, $tag); $countIntersect = $resIntersect["count"]; $entities = merge_entities_by_guid($entitiesByTag, $entitiesByTitle); $count = $countByTag + $countByTitle - $countIntersect; $result = array("entities" => $entities, "count" => $count); return $result; }
function find_zhaohus_by_tag_title($options, $tag) { $options['by_tag'] = true; $options['by_title'] = false; $resByTag = zhaohu_manager_find_zhaohus($options, $tag); $entitiesByTag = $resByTag["entities"]; $countByTag = $resByTag["count"]; //fordebug register_error("countByTag {$countByTag}"); $options['by_tag'] = false; $options['by_title'] = true; $resByTitle = zhaohu_manager_find_zhaohus($options, $tag); $entitiesByTitle = $resByTitle["entities"]; $countByTitle = $resByTitle["count"]; //fordebug register_error("countByTitle {$countByTitle}"); if ($countByTag == 0) { return $resByTitle; } if ($countByTitle == 0) { return $resByTag; } $options['by_tag'] = true; $options['by_title'] = true; $options['count_only'] = true; $resIntersect = zhaohu_manager_find_zhaohus($options, $tag); $countIntersect = $resIntersect["count"]; //fordebug register_error("countIntersect {$countIntersect}"); $entities = merge_entities_by_guid($entitiesByTag, $entitiesByTitle); $count = $countByTag + $countByTitle - $countIntersect; $result = array("entities" => $entities, "count" => $count); return $result; }