Skip to content

Commit

Permalink
Fix problems with Lucene (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
serras authored May 25, 2023
1 parent ec79dd5 commit f32004d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion integrations/lucene/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ java {

dependencies {
implementation(projects.xefCore)
implementation(libs.apache.lucene)
api(libs.apache.lucene)
}

tasks.withType<AbstractPublishToMaven> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ open class Lucene(
private val requestConfig =
RequestConfig(EmbeddingModel.TextEmbeddingAda002, RequestConfig.Companion.User("user"))

override suspend fun addTexts(texts: List<String>) =
override suspend fun addTexts(texts: List<String>) {
texts.forEach {
val embedding = embeddings?.embedQuery(it, requestConfig)
val doc =
Expand All @@ -45,6 +45,8 @@ open class Lucene(
}
writer.addDocument(doc)
}
writer.commit()
}

override suspend fun similaritySearch(query: String, limit: Int): List<String> =
search(FuzzyQuery(Term("contents", query)), limit)
Expand Down

0 comments on commit f32004d

Please sign in to comment.