UnitTest et phonetic


(Blured Derulb) #1

Bonjour,

Je voudrais ajouter à mon test unitaire des recherches phonétiques basés sur beider_morse.

Mon mapping contient les infos suivantes :

...
.startObject("dbl_metaphone")
  .field("type", "phonetic")
  .field("encoder", "beider_morse")
  .field("languageset", "french")
.endObject()
.startObject("analyzer")
  .startObject("french_phonetic")                    		
    .field("tokenizer", "standard")
    .field("filter", "french_elision", "lowercase", "french_stop", "dbl_metaphone", "french_stemmer")                    	
  .endObject()
.endObject()
...

J'utilise un junit standard, sur le @BeforeClass j'ai

Node node = nodeBuilder().local(true).node();
client = node.client();

Le problème est que lors du parsing de l'analyseur phonetic (qui est un plugin) l'ELS embarqué indique

org.elasticsearch.ElasticsearchIllegalArgumentException: failed to find token filter type [phonetic] for [dbl_metaphone]
	at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:249)
	at org.elasticsearch.common.inject.AbstractModule.configure(AbstractModule.java:60)
	at org.elasticsearch.common.inject.spi.Elements$RecordingBinder.install(Elements.java:204)
	at org.elasticsearch.common.inject.spi.Elements.getElements(Elements.java:85)
	at org.elasticsearch.common.inject.InjectorShell$Builder.build(InjectorShell.java:130)
	at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:99)
	at org.elasticsearch.common.inject.InjectorImpl.createChildInjector(InjectorImpl.java:131)
	at org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:69)
	at org.elasticsearch.indices.InternalIndicesService.createIndex(InternalIndicesService.java:299)
	at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:382)
	at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:329)
	at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:153)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.common.settings.NoClassSettingsException: Failed to load class setting [type] with value [phonetic]
	at org.elasticsearch.common.settings.ImmutableSettings.loadClass(ImmutableSettings.java:471)
	at org.elasticsearch.common.settings.ImmutableSettings.getAsClass(ImmutableSettings.java:459)
	at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:239)
	... 14 more
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.index.analysis.phonetic.PhoneticTokenFilterFactory
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at org.elasticsearch.common.settings.ImmutableSettings.loadClass(ImmutableSettings.java:469)
	... 16 more

Ceci semble normal puisque le plugin n'a pas été installé sur l'elastic embarqué dans le test unitaire ? Comment faire pour tester avec ce plugin activé / comment activer ce plugin ?

Merci d'avance,
Blured.


(system) #2