fix search not working properly for aliases to multiple tags
fix issue 359
This commit is contained in:
parent
14899e79ad
commit
9f06a5c565
1 changed files with 19 additions and 8 deletions
|
@ -663,6 +663,8 @@ class Image {
|
|||
}
|
||||
}
|
||||
|
||||
$terms = Tag::resolve_aliases($terms);
|
||||
|
||||
// parse the words that are searched for into
|
||||
// various types of querylet
|
||||
foreach($terms as $term) {
|
||||
|
@ -675,8 +677,6 @@ class Image {
|
|||
continue;
|
||||
}
|
||||
|
||||
$term = Tag::resolve_alias($term);
|
||||
|
||||
$stpe = new SearchTermParseEvent($term, $terms);
|
||||
send_event($stpe);
|
||||
if($stpe->is_querylet_set()) {
|
||||
|
@ -824,6 +824,8 @@ class Image {
|
|||
}
|
||||
}
|
||||
|
||||
$terms = Tag::resolve_aliases($terms);
|
||||
|
||||
reset($terms); // rewind to first element in array.
|
||||
|
||||
// turn each term into a specific type of querylet
|
||||
|
@ -833,8 +835,6 @@ class Image {
|
|||
$negative = true;
|
||||
$term = substr($term, 1);
|
||||
}
|
||||
|
||||
$term = Tag::resolve_alias($term);
|
||||
|
||||
$stpe = new SearchTermParseEvent($term, $terms);
|
||||
send_event($stpe);
|
||||
|
@ -1082,11 +1082,22 @@ class Tag {
|
|||
assert(is_array($tags));
|
||||
|
||||
$new = array();
|
||||
foreach($tags as $tag) {
|
||||
$new_set = explode(' ', Tag::resolve_alias($tag));
|
||||
foreach($new_set as $new_one) {
|
||||
$new[] = $new_one;
|
||||
|
||||
$i = 0;
|
||||
$tag_count = count($tags);
|
||||
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
|
||||
|
|
Reference in a new issue