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.SearchResultType
import net.nemerosa.ontrack.model.structure.SearchResults
import net.nemerosa.ontrack.model.structure.SearchService
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*

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

    @PostMapping("")
    fun search(@RequestBody request: SearchRequest): ResponseEntity =
            ResponseEntity.ok(searchService.paginatedSearch(request))

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

    @PostMapping("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