diff --git a/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt b/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt index 2a01e9e..2b178fd 100644 --- a/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt +++ b/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt @@ -151,7 +151,7 @@ fun main() { if (allowClasses) add(MappingsEntryType.CLASS) if (allowMethods) add(MappingsEntryType.METHOD) if (allowFields) add(MappingsEntryType.FIELD) - }.toTypedArray()) + }.toTypedArray(), limit = limit) Thread.sleep(1000) call.respond( SearchResultEntries( diff --git a/backend/src/main/kotlin/me/shedaniel/linkie/web/MappingsQueryUtils.kt b/backend/src/main/kotlin/me/shedaniel/linkie/web/MappingsQueryUtils.kt index d420f1f..4a6cc3a 100644 --- a/backend/src/main/kotlin/me/shedaniel/linkie/web/MappingsQueryUtils.kt +++ b/backend/src/main/kotlin/me/shedaniel/linkie/web/MappingsQueryUtils.kt @@ -18,11 +18,12 @@ object MappingsQueryUtils { val fuzzy: Boolean, ) - suspend fun query(mappings: MappingsContainer, searchTerm: String, vararg types: MappingsEntryType): Result { + suspend fun query(mappings: MappingsContainer, searchTerm: String, vararg types: MappingsEntryType, limit: Int): Result { require(types.isNotEmpty()) val context = QueryContext( provider = { mappings }, searchKey = searchTerm, + limit = limit.toLong(), ) val result: MutableList> = mutableListOf() var classes: ClassResultList? = null