Commit f63e28b8 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

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 ...@@ -20,6 +20,7 @@ package eu.nomad_lab.repo.objects
import com.sksamuel.elastic4s.http.{ ElasticDsl => ES } import com.sksamuel.elastic4s.http.{ ElasticDsl => ES }
import com.sksamuel.elastic4s.mappings.dynamictemplate.DynamicMapping import com.sksamuel.elastic4s.mappings.dynamictemplate.DynamicMapping
import com.sksamuel.elastic4s.mappings.{ FieldDefinition, MappingDefinition, ObjectFieldDefinition } 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.{ Base32, CompactSha, LocalEnv }
import eu.nomad_lab.elasticsearch.ConnectorElasticSearch import eu.nomad_lab.elasticsearch.ConnectorElasticSearch
...@@ -34,8 +35,8 @@ object Calculation { ...@@ -34,8 +35,8 @@ object Calculation {
def fieldDefinition: FieldDefinition = { def fieldDefinition: FieldDefinition = {
ES.objectField(sectionName).fields( ES.objectField(sectionName).fields(
Seq( Seq(
ES.keywordField("main_file_uri"), ES.textField("main_file_uri").analyzer("pathSplitter"),
ES.keywordField("secondary_file_uris"), ES.textField("secondary_file_uris").analyzer("pathSplitter"),
ES.keywordField("repository_filepaths").index(false), ES.keywordField("repository_filepaths").index(false),
ES.keywordField("repository_archive_gid"), ES.keywordField("repository_archive_gid"),
ES.longField("repository_calc_id").stored(true), ES.longField("repository_calc_id").stored(true),
...@@ -50,6 +51,13 @@ object Calculation { ...@@ -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 * Mapping (index definition) of a calculation
*/ */
...@@ -158,4 +166,4 @@ case class Calculation( ...@@ -158,4 +166,4 @@ case class Calculation(
) )
} }
case class CalculationWrapper(section_repository_info: Calculation) case class CalculationWrapper(section_repository_info: Calculation)
\ No newline at end of file
Supports Markdown
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