forked from bayang/jelu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see https://bayang.github.io/jelu-web/usage/search/ for the documentation
- Loading branch information
Showing
19 changed files
with
905 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/io/github/bayang/jelu/config/LuceneConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.github.bayang.jelu.config | ||
|
||
import io.github.bayang.jelu.search.MultiLingualAnalyzer | ||
import io.github.bayang.jelu.search.MultiLingualNGramAnalyzer | ||
import org.apache.lucene.store.ByteBuffersDirectory | ||
import org.apache.lucene.store.Directory | ||
import org.apache.lucene.store.FSDirectory | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.context.annotation.Profile | ||
import java.nio.file.Paths | ||
|
||
@Configuration | ||
class LuceneConfiguration( | ||
private val jeluProperties: JeluProperties | ||
) { | ||
|
||
@Bean | ||
fun indexAnalyzer() = | ||
with(jeluProperties.lucene.indexAnalyzer) { | ||
MultiLingualNGramAnalyzer(minGram, maxGram, preserveOriginal) | ||
} | ||
|
||
@Bean | ||
fun searchAnalyzer() = | ||
MultiLingualAnalyzer() | ||
|
||
@Bean | ||
@Profile("test") | ||
fun memoryDirectory(): Directory = | ||
ByteBuffersDirectory() | ||
|
||
@Bean | ||
@Profile("!test") | ||
fun diskDirectory(): Directory = | ||
FSDirectory.open(Paths.get(jeluProperties.lucene.dataDirectory)) | ||
} |
Oops, something went wrong.