Add local namespace searching.

This commit is contained in:
NerdNumber9 2017-02-28 16:56:29 -05:00
parent 8fa798cf63
commit 8a05fc8966

View File

@ -49,6 +49,7 @@ class SearchEngine {
return false return false
} }
} else { } else {
if(component.tag!!.components.size > 0) {
//Match namespace //Match namespace
val ns = metadata.tags.entries.asSequence().filter { val ns = metadata.tags.entries.asSequence().filter {
it.key == component.namespace it.key == component.namespace
@ -56,6 +57,17 @@ class SearchEngine {
//Match tags //Match tags
if (!matchTagList(ns, component.tag!!)) if (!matchTagList(ns, component.tag!!))
return false return false
} else {
//Perform namespace search
val hasNs = metadata.tags.entries.find {
it.key == component.namespace
} != null
if(hasNs && component.excluded)
return false
else if(!hasNs && !component.excluded)
return false
}
} }
} }
} }
@ -87,9 +99,10 @@ class SearchEngine {
fun flushAll() { fun flushAll() {
flushText() flushText()
if (queuedText.isNotEmpty()) { if (queuedText.isNotEmpty() || namespace != null) {
val component = namespace?.apply { val component = namespace?.apply {
tag = flushToText() tag = flushToText()
namespace = null
} ?: flushToText() } ?: flushToText()
component.excluded = nextIsExcluded component.excluded = nextIsExcluded
component.exact = nextIsExact component.exact = nextIsExact