All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.boot.ui.SearchController.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.boot.ui

import net.nemerosa.ontrack.model.structure.SearchRequest
import net.nemerosa.ontrack.model.structure.SearchResult
import net.nemerosa.ontrack.model.structure.SearchResultType
import net.nemerosa.ontrack.model.structure.SearchService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController

/**
 * End point for the search.
 */
@RestController
class SearchController(
        private val searchService: SearchService
) {

    @PostMapping("/search")
    fun search(@RequestBody request: SearchRequest): Collection = searchService.search(request)

    /**
     * Gets the list of search types
     */
    @GetMapping("/search/types")
    fun getSearchTypes(): List = searchService.searchResultTypes

    @PostMapping("/search/index/reset")
    fun searchIndexReset(@RequestBody request: SearchIndexResetRequest) = searchService.indexReset(request.reindex)

    data class SearchIndexResetRequest(val reindex: Boolean = false)

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy