diff --git a/src/main/java/com/example/daemawiki/domain/document/repository/DocumentRepository.java b/src/main/java/com/example/daemawiki/domain/document/repository/DocumentRepository.java index e72204c2..8abe34bc 100644 --- a/src/main/java/com/example/daemawiki/domain/document/repository/DocumentRepository.java +++ b/src/main/java/com/example/daemawiki/domain/document/repository/DocumentRepository.java @@ -1,6 +1,7 @@ package com.example.daemawiki.domain.document.repository; import com.example.daemawiki.domain.document.model.DefaultDocument; +import org.springframework.data.mongodb.repository.Query; import org.springframework.data.mongodb.repository.ReactiveMongoRepository; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -8,6 +9,7 @@ public interface DocumentRepository extends ReactiveMongoRepository { Mono findByTitle(String title); - Flux findAllByGroupsContains(String group); + @Query("{'$or':[{'title':{$regex:'?0', $options:'i'}}, {'content':{$regex:'?0', $options:'i'}}]}") + Flux findByTextContaining(String text); }