split analyzer for main_file_uri and secondary_file_uris

parent 5af3cea7
Pipeline #40754 failed with stages
in 49 minutes and 56 seconds
......@@ -20,6 +20,7 @@ package eu.nomad_lab.repo.objects
import com.sksamuel.elastic4s.http.{ ElasticDsl => ES }
import com.sksamuel.elastic4s.mappings.dynamictemplate.DynamicMapping
import com.sksamuel.elastic4s.mappings.{ FieldDefinition, MappingDefinition, ObjectFieldDefinition }
import com.sksamuel.elastic4s.analyzers.AnalyzerDefinition
import eu.nomad_lab.{ Base32, CompactSha, LocalEnv }
import eu.nomad_lab.elasticsearch.ConnectorElasticSearch
......@@ -34,8 +35,8 @@ object Calculation {
def fieldDefinition: FieldDefinition = {
ES.objectField(sectionName).fields(
Seq(
ES.keywordField("main_file_uri"),
ES.keywordField("secondary_file_uris"),
ES.textField("main_file_uri").analyzer("pathSplitter"),
ES.textField("secondary_file_uris").analyzer("pathSplitter"),
ES.keywordField("repository_filepaths").index(false),
ES.keywordField("repository_archive_gid"),
ES.longField("repository_calc_id").stored(true),
......@@ -50,6 +51,13 @@ object Calculation {
)
}
/**
* Analyzers used by the fields
*/
def analysis: Seq[AnalyzerDefinition] = {
Seq(ES.patternAnalyzer("pathSplitter", "/+"))
}
/**
* Mapping (index definition) of a calculation
*/
......@@ -158,4 +166,4 @@ case class Calculation(
)
}
case class CalculationWrapper(section_repository_info: Calculation)
\ No newline at end of file
case class CalculationWrapper(section_repository_info: Calculation)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment