Skip to content

Commit

Permalink
Add query limit
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Jun 2, 2022
1 parent 199da59 commit c2d45b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResultHolder<*>> = mutableListOf()
var classes: ClassResultList? = null
Expand Down

0 comments on commit c2d45b4

Please sign in to comment.