use resolve_aliases rather than resolve_alias

This commit is contained in:
Daku 2014-01-16 03:28:23 +00:00
parent b5f70de496
commit c07dc2e0ab

View file

@ -666,6 +666,8 @@ class Image {
} }
} }
$terms = Tag::resolve_aliases($terms);
// parse the words that are searched for into // parse the words that are searched for into
// various types of querylet // various types of querylet
foreach($terms as $term) { foreach($terms as $term) {
@ -678,15 +680,6 @@ class Image {
continue; continue;
} }
$aliases = explode(" ", Tag::resolve_alias($term));
$found = array_search($term, $aliases);
if($found !== false){
unset($aliases[$found]);
}else{
$term = array_shift($aliases);
}
foreach($aliases as $alias) array_push($terms, $alias);
$stpe = new SearchTermParseEvent($term, $terms); $stpe = new SearchTermParseEvent($term, $terms);
send_event($stpe); send_event($stpe);
if($stpe->is_querylet_set()) { if($stpe->is_querylet_set()) {
@ -834,6 +827,8 @@ class Image {
} }
} }
$terms = Tag::resolve_aliases($terms);
reset($terms); // rewind to first element in array. reset($terms); // rewind to first element in array.
// turn each term into a specific type of querylet // turn each term into a specific type of querylet
@ -844,15 +839,6 @@ class Image {
$term = substr($term, 1); $term = substr($term, 1);
} }
$aliases = explode(" ", Tag::resolve_alias($term));
$found = array_search($term, $aliases);
if($found !== false){
unset($aliases[$found]);
}else{
$term = array_shift($aliases);
}
foreach($aliases as $alias) array_push($terms, $alias);
$stpe = new SearchTermParseEvent($term, $terms); $stpe = new SearchTermParseEvent($term, $terms);
send_event($stpe); send_event($stpe);
if($stpe->is_querylet_set()) { if($stpe->is_querylet_set()) {
@ -1099,12 +1085,23 @@ class Tag {
assert(is_array($tags)); assert(is_array($tags));
$new = array(); $new = array();
foreach($tags as $tag) {
$new_set = explode(' ', Tag::resolve_alias($tag)); $i = 0;
foreach($new_set as $new_one) { $tag_count = count($tags);
$new[] = $new_one; while($i<$tag_count) {
$aliases = explode(' ', Tag::resolve_alias($tags[$i]));
foreach($aliases as $alias){
if(!in_array($alias, $new)){
if($tags[$i] == $alias){
$new[] = $alias;
}elseif(!in_array($alias, $tags)){
$tags[] = $alias;
$tag_count++;
} }
} }
}
$i++;
}
$new = array_iunique($new); // remove any duplicate tags $new = array_iunique($new); // remove any duplicate tags
return $new; return $new;