Commit 1bc62901 authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet
Browse files

feat: use english analyzer for description, french analyzer for name and dataSource

parent 6615531d
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfo
import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.run.BootRun
......@@ -59,6 +60,9 @@ tasks {
val test by getting(Test::class) {
useJUnitPlatform()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}
val jacocoTestReport by getting(JacocoReport::class) {
......
......@@ -11,6 +11,7 @@
},
"name": {
"type": "text",
"analyzer": "french",
"fields": {
"keyword": {
"type": "keyword",
......@@ -19,11 +20,11 @@
}
},
"description": {
"analyzer": "english",
"type": "text"
},
"pillarName": {
"type": "text",
"analyzer": "french",
"fields": {
"keyword": {
"type": "keyword",
......
# Mapping of genetic resources
All properties use the default analyzer except for `name`, `description` and `databaseSource`, because
they're supposed to contain small English or Latin terms, or country names, without any stopword or punctuation.
`name` uses the `french` analyzer. Many resources have a French name. Using the french analyzer allows using "ardeche"
to find "Ardèche", for example, and allows using French punctuation (and thus allows finding "Plant d'Ardèche" when
searching for "Ardèche".
`description` uses the `english` analyzer. The description is in English, and contains actual sentences. Using the
english analyzer allows using the English punctuation to tokenize the text, and to remove the English stopwords that
could exist in the description. The French name is often part of the description, but it's already indexed in French
by the name property.
`databaseSource` uses the `french` analyzer. The names of the database sources are usually French names, so using the
French analyzer makes sense. It allows for example to type "florilege" and find "Florilège".
......@@ -349,7 +349,8 @@ class GeneticResourceDaoTest {
.withTaxon(Arrays.asList("Girolla mucha gusta"))
.build();
geneticResourceDao.saveAll(Arrays.asList(geneticResource1, geneticResource2));
geneticResourceDao.saveAll(Arrays.asList(new IndexedGeneticResource(geneticResource1),
new IndexedGeneticResource(geneticResource2)));
AggregatedPage<GeneticResource> result =
geneticResourceDao.search("foo", true, SearchRefinements.EMPTY, firstPage);
......@@ -417,7 +418,12 @@ class GeneticResourceDaoTest {
.withDatabaseSource("D22")
.build();
geneticResourceDao.saveAll(Arrays.asList(resource1, resource2, resource3, resource4, resource5));
geneticResourceDao.saveAll(Arrays.asList(
new IndexedGeneticResource(resource1),
new IndexedGeneticResource(resource2),
new IndexedGeneticResource(resource3),
new IndexedGeneticResource(resource4),
new IndexedGeneticResource(resource5)));
Terms pillars = geneticResourceDao.findPillars();
......@@ -481,7 +487,8 @@ class GeneticResourceDaoTest {
.withDescription("hello world")
.build();
geneticResourceDao.saveAll(Arrays.asList(geneticResource1, geneticResource2));
geneticResourceDao.saveAll(Arrays.asList(new IndexedGeneticResource(geneticResource1),
new IndexedGeneticResource(geneticResource2)));
}
@Test
......
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