Created
May 7, 2010 10:04
-
-
Save sdepablos/393249 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $intersections = false; | |
| $filters = false; | |
| // If any follows, followed_by, or tags are specified, attempt to narrow the search. | |
| foreach ($this->follows as $cond) | |
| { | |
| $filters = true; | |
| $keys = $this->database->set_members(Stalkr::get_type_table($this->type) . ':fing:' . $cond); | |
| if (!$keys) continue; | |
| $intersections = ($intersections === false) ? $keys : array_intersect($intersections, $keys); | |
| } | |
| foreach ($this->followed_by as $cond) | |
| { | |
| $filters = true; | |
| $keys = $this->database->set_members(Stalkr::get_type_table($this->type) . ':fer:' . $cond); | |
| if (!$keys) continue; | |
| $intersections = ($intersections === false) ? $keys : array_intersect($intersections, $keys); | |
| } | |
| foreach ($this->tags as $tag) | |
| { | |
| $filters = true; | |
| $tag = ctype_alnum($tag) ? $tag : base64_encode($tag); | |
| $keys = $this->database->set_members(Stalkr::get_type_table($this->type) . ':tag:' . $tag); | |
| if (!$keys) continue; | |
| $intersections = ($intersections === false) ? $keys : array_intersect($intersections, $keys); | |
| } | |
| // Initialize the result set. | |
| $this->result = array(); | |
| // Check for conditions and no results | |
| if(($intersections === false) && ($filters === true)) { | |
| return array(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment