private static boolean hasElasticsearchIndexManager(ExtendedSearchIntegrator integrator, IndexedTypeSet entityTypes) { for ( IndexedTypeIdentifier entityType : entityTypes ) { EntityIndexBinding binding = integrator.getIndexBinding( entityType ); if ( binding == null ) { continue; } IndexManagerType indexManagerType = binding.getIndexManagerType(); if ( ElasticsearchIndexManagerType.INSTANCE.equals( indexManagerType ) ) { return true; } } return false; }
private static boolean hasElasticsearchIndexManager(ExtendedSearchIntegrator integrator, IndexedTypeSet entityTypes) { for ( IndexedTypeIdentifier entityType : entityTypes ) { EntityIndexBinding binding = integrator.getIndexBinding( entityType ); if ( binding == null ) { continue; } IndexManagerType indexManagerType = binding.getIndexManagerType(); if ( ElasticsearchIndexManagerType.INSTANCE.equals( indexManagerType ) ) { return true; } } return false; }
@Test @Category(SkipOnElasticsearch.class) // Unused AnalyzerDefs are always bound to the Lucene registry, making this test fail on ES public void shouldContainOnlyTheDefinedAnalyzers() throws Exception { ExtendedSearchIntegrator factory = sfHolder.getSearchFactory(); IndexManagerType indexManagerType = factory.getIndexBindings().get( Sample.class ).getIndexManagerType(); Map<String, AnalyzerReference> analyzerReferences = factory.getIntegration( indexManagerType ).getAnalyzerRegistry().getNamedAnalyzerReferences(); assertThat( analyzerReferences.keySet() ).containsExactlyInAnyOrder( "package-analyzer", "class-analyzer" ); Map<String, AnalyzerReference> normalizerReferences = factory.getIntegration( indexManagerType ).getNormalizerRegistry().getNamedNormalizerReferences(); assertThat( normalizerReferences.keySet() ).containsExactlyInAnyOrder( "package-normalizer", "class-normalizer" ); }
public HSearchEntityContext(IndexedTypeIdentifier entityType, ExtendedSearchIntegrator factory) { // get a type for meta-data retrieval; if the given type itself is not indexed, one indexed sub-type will // be used; note that this allows to e.g. query for fields not present on the given type but on one of its // sub-types, but we accept this for now indexBoundType = getIndexBoundType( entityType, factory ); if ( indexBoundType == null ) { IndexedTypeSet configuredSubTypes = factory.getConfiguredTypesPolymorphic( entityType.asTypeSet() ); if ( configuredSubTypes.isEmpty() ) { throw log.cantQueryUnconfiguredType( entityType.getName() ); } else { throw log.cantQueryUnindexedType( entityType.getName() ); } } originalAnalyzerReference = factory.getAnalyzerReference( indexBoundType ); queryAnalyzerReferenceBuilder = factory.getAnalyzerReference( indexBoundType ).startCopy(); IndexManagerType indexManagerType = factory.getIndexBinding( indexBoundType ).getIndexManagerType(); analyzerRegistry = factory.getIntegration( indexManagerType ).getAnalyzerRegistry(); }
public HSearchEntityContext(IndexedTypeIdentifier entityType, ExtendedSearchIntegrator factory) { // get a type for meta-data retrieval; if the given type itself is not indexed, one indexed sub-type will // be used; note that this allows to e.g. query for fields not present on the given type but on one of its // sub-types, but we accept this for now indexBoundType = getIndexBoundType( entityType, factory ); if ( indexBoundType == null ) { IndexedTypeSet configuredSubTypes = factory.getConfiguredTypesPolymorphic( entityType.asTypeSet() ); if ( configuredSubTypes.isEmpty() ) { throw log.cantQueryUnconfiguredType( entityType.getName() ); } else { throw log.cantQueryUnindexedType( entityType.getName() ); } } originalAnalyzerReference = factory.getAnalyzerReference( indexBoundType ); queryAnalyzerReferenceBuilder = factory.getAnalyzerReference( indexBoundType ).startCopy(); IndexManagerType indexManagerType = factory.getIndexBinding( indexBoundType ).getIndexManagerType(); analyzerRegistry = factory.getIntegration( indexManagerType ).getAnalyzerRegistry(); }