Subject: [PATCH] ISPN-15030 Remove support for Search 5 annotations
---
Index: client/hotrod-client/src/test/java/org/infinispan/client/hotrod/query/legacy/RemoteHS5LegacyAnnotationsTest.java
===================================================================
diff --git a/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/query/legacy/RemoteHS5LegacyAnnotationsTest.java b/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/query/legacy/RemoteHS5LegacyAnnotationsTest.java
deleted file mode 100644
--- a/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/query/legacy/RemoteHS5LegacyAnnotationsTest.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ /dev/null	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
@@ -1,65 +0,0 @@
-package org.infinispan.client.hotrod.query.legacy;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.infinispan.configuration.cache.IndexStorage.LOCAL_HEAP;
-
-import org.infinispan.client.hotrod.RemoteCache;
-import org.infinispan.client.hotrod.Search;
-import org.infinispan.client.hotrod.test.SingleHotRodServerTest;
-import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.manager.EmbeddedCacheManager;
-import org.infinispan.protostream.SerializationContextInitializer;
-import org.infinispan.query.dsl.Query;
-import org.infinispan.query.dsl.QueryFactory;
-import org.infinispan.query.dsl.QueryResult;
-import org.infinispan.query.model.LegacyGame;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.testng.annotations.Test;
-
-@Test(groups = "functional", testName = "org.infinispan.client.hotrod.query.legacy.RemoteHS5LegacyAnnotationsTest")
-public class RemoteHS5LegacyAnnotationsTest extends SingleHotRodServerTest {
-
-   @Override
-   protected EmbeddedCacheManager createCacheManager() throws Exception {
-      ConfigurationBuilder indexed = new ConfigurationBuilder();
-      indexed.indexing().enable()
-            .storage(LOCAL_HEAP)
-            .addIndexedEntity("LegacyGame");
-
-      EmbeddedCacheManager manager = TestCacheManagerFactory.createServerModeCacheManager();
-      manager.defineConfiguration("indexed-games", indexed.build());
-      return manager;
-   }
-
-   @Override
-   protected SerializationContextInitializer contextInitializer() {
-      return LegacyGame.LegacyGameSchema.INSTANCE;
-   }
-
-   @Test
-   public void test() {
-      RemoteCache<String, LegacyGame> remoteCache = remoteCacheManager.getCache("indexed-games");
-      remoteCache.put("a", new LegacyGame("Game A", "bla bla bla bli", 1999));
-      remoteCache.put("b", new LegacyGame("Game B", "bla bla bla uuu", 2013));
-      remoteCache.put("c", new LegacyGame("Game C", "bla aaa bla bli", 2000));
-
-      QueryFactory factory = Search.getQueryFactory(remoteCache);
-      Query<String[]> queryNames =
-            // keep using the old API:
-            factory.create("select g.name from LegacyGame g where g.name : 'Game B'");
-      QueryResult<String[]> resultNames = queryNames.execute();
-
-      assertThat(resultNames.count().isExact()).isTrue();
-      assertThat(resultNames.count().value()).isEqualTo(1);
-      assertThat(resultNames.list()).containsExactly(new String[]{"Game B"});
-
-      Query<LegacyGame> queryGames =
-            // keep using the old API:
-            factory.create("from LegacyGame g where g.description : 'bli' order by g.releaseYear desc");
-      QueryResult<LegacyGame> resultGames = queryGames.execute();
-
-      assertThat(resultGames.count().isExact()).isTrue();
-      assertThat(resultGames.count().value()).isEqualTo(2);
-      assertThat(resultGames.list()).extracting("name").containsExactly("Game C", "Game A");
-   }
-}
Index: query/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/query/pom.xml b/query/pom.xml
--- a/query/pom.xml	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ b/query/pom.xml	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -53,11 +53,6 @@
            <artifactId>infinispan-clustered-lock</artifactId>
        </dependency>
 
-      <dependency>
-         <groupId>org.hibernate.search</groupId>
-         <artifactId>hibernate-search-v5migrationhelper-engine</artifactId>
-      </dependency>
-
       <dependency>
          <groupId>org.hibernate.search</groupId>
          <artifactId>hibernate-search-mapper-pojo-base</artifactId>
Index: query/src/test/java/org/infinispan/query/legacy/EmbeddedHS5LegacyAnnotationsTest.java
===================================================================
diff --git a/query/src/test/java/org/infinispan/query/legacy/EmbeddedHS5LegacyAnnotationsTest.java b/query/src/test/java/org/infinispan/query/legacy/EmbeddedHS5LegacyAnnotationsTest.java
deleted file mode 100644
--- a/query/src/test/java/org/infinispan/query/legacy/EmbeddedHS5LegacyAnnotationsTest.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ /dev/null	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
@@ -1,55 +0,0 @@
-package org.infinispan.query.legacy;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.infinispan.configuration.cache.IndexStorage.LOCAL_HEAP;
-
-import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.manager.EmbeddedCacheManager;
-import org.infinispan.query.Search;
-import org.infinispan.query.dsl.Query;
-import org.infinispan.query.dsl.QueryFactory;
-import org.infinispan.query.dsl.QueryResult;
-import org.infinispan.query.model.LegacyGame;
-import org.infinispan.test.SingleCacheManagerTest;
-import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.testng.annotations.Test;
-
-@Test(groups = "functional", testName = "query.legacy.EmbeddedHS5LegacyAnnotationsTest")
-public class EmbeddedHS5LegacyAnnotationsTest extends SingleCacheManagerTest {
-
-   @Override
-   protected EmbeddedCacheManager createCacheManager() throws Exception {
-      ConfigurationBuilder indexed = new ConfigurationBuilder();
-      indexed.indexing().enable()
-            .storage(LOCAL_HEAP)
-            .addIndexedEntity("org.infinispan.query.model.LegacyGame");
-
-      return TestCacheManagerFactory.createCacheManager(indexed);
-   }
-
-   @Test
-   public void test() {
-      cache.put("a", new LegacyGame("Game A", "bla bla bla bli", 1999));
-      cache.put("b", new LegacyGame("Game B", "bla bla bla uuu", 2013));
-      cache.put("c", new LegacyGame("Game C", "bla aaa bla bli", 2000));
-
-      QueryFactory factory = Search.getQueryFactory(cache);
-      Query<String[]> queryNames =
-            // keep using the old API:
-            factory.create("select g.name from org.infinispan.query.model.LegacyGame g where g.name : 'Game B'");
-      QueryResult<String[]> resultNames = queryNames.execute();
-
-      assertThat(resultNames.count().isExact()).isTrue();
-      assertThat(resultNames.count().value()).isEqualTo(1);
-      assertThat(resultNames.list()).containsExactly(new String[]{"Game B"});
-
-      Query<LegacyGame> queryGames =
-            // keep using the old API:
-            factory.create("from org.infinispan.query.model.LegacyGame g where g.description : 'bli' order by g.releaseYear desc");
-      QueryResult<LegacyGame> resultGames = queryGames.execute();
-
-      assertThat(resultGames.count().isExact()).isTrue();
-      assertThat(resultGames.count().value()).isEqualTo(2);
-      assertThat(resultGames.list()).extracting("name").containsExactly("Game C", "Game A");
-   }
-}
Index: query/src/test/java/org/infinispan/query/model/LegacyGame.java
===================================================================
diff --git a/query/src/test/java/org/infinispan/query/model/LegacyGame.java b/query/src/test/java/org/infinispan/query/model/LegacyGame.java
deleted file mode 100644
--- a/query/src/test/java/org/infinispan/query/model/LegacyGame.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ /dev/null	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
@@ -1,54 +0,0 @@
-package org.infinispan.query.model;
-
-import org.hibernate.search.annotations.Analyze;
-import org.hibernate.search.annotations.Analyzer;
-import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.annotations.SortableField;
-import org.hibernate.search.annotations.Store;
-import org.infinispan.protostream.GeneratedSchema;
-import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
-import org.infinispan.protostream.annotations.ProtoFactory;
-import org.infinispan.protostream.annotations.ProtoField;
-
-@Indexed(index = "legacy-game")
-public class LegacyGame {
-
-   private final String name;
-
-   private final String description;
-
-   private final Integer releaseYear;
-
-   @ProtoFactory
-   public LegacyGame(String name, String description, Integer releaseYear) {
-      this.name = name;
-      this.description = description;
-      this.releaseYear = releaseYear;
-   }
-
-   @Field(store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = "keyword"))
-   @ProtoField(1)
-   public String getName() {
-      return name;
-   }
-
-   @Field(analyze = Analyze.YES)
-   @Analyzer(definition = "whitespace")
-   @ProtoField(2)
-   public String getDescription() {
-      return description;
-   }
-
-   @Field
-   @SortableField
-   @ProtoField(3)
-   public Integer getReleaseYear() {
-      return releaseYear;
-   }
-
-   @AutoProtoSchemaBuilder(includeClasses = {LegacyGame.class})
-   public interface LegacyGameSchema extends GeneratedSchema {
-      LegacyGameSchema INSTANCE = new LegacyGameSchemaImpl();
-   }
-}
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -48,8 +48,7 @@
 import org.infinispan.query.remote.ProtobufMetadataManager;
 import org.infinispan.query.remote.client.ProtobufMetadataManagerConstants;
 import org.infinispan.query.remote.client.impl.MarshallerRegistration;
-import org.infinispan.query.remote.impl.indexing.infinispan.InfinispanAnnotations;
-import org.infinispan.query.remote.impl.indexing.search5.Search5Annotations;
+import org.infinispan.query.remote.impl.indexing.infinispan.IndexAnnotations;
 import org.infinispan.query.remote.impl.logging.Log;
 import org.infinispan.registry.InternalCacheRegistry;
 import org.infinispan.security.actions.SecurityActions;
@@ -84,8 +83,7 @@
 
    public ProtobufMetadataManagerImpl() {
       Configuration.Builder protostreamCfgBuilder = Configuration.builder();
-      Search5Annotations.configure(protostreamCfgBuilder);
-      InfinispanAnnotations.configure(protostreamCfgBuilder);
+      IndexAnnotations.configure(protostreamCfgBuilder);
       serCtx = ProtobufUtil.newSerializationContext(protostreamCfgBuilder.build());
       try {
          MarshallerRegistration.init(serCtx);
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -14,9 +14,6 @@
    public static final String INDEXED_ANNOTATION = "Indexed";
    public static final String INDEXED_INDEX_ATTRIBUTE = "index";
 
-   public static final String YES = "YES";
-   public static final String NO = "NO";
-
    /**
     * Indicates if the type is indexed.
     */
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -10,7 +10,7 @@
 import org.infinispan.query.remote.impl.indexing.aggregator.BigDecimalAggregator;
 import org.infinispan.query.remote.impl.indexing.aggregator.BigIntegerAggregator;
 import org.infinispan.query.remote.impl.indexing.aggregator.TypeAggregator;
-import org.infinispan.query.remote.impl.indexing.infinispan.InfinispanAnnotations;
+import org.infinispan.query.remote.impl.indexing.infinispan.IndexAnnotations;
 import org.infinispan.query.remote.impl.mapping.reference.FieldReferenceProvider;
 import org.infinispan.query.remote.impl.mapping.reference.IndexReferenceHolder;
 
@@ -55,7 +55,7 @@
       String fieldPath = messageContext.getFieldPath();
       fieldPath = fieldPath != null ? fieldPath + '.' + fieldDescriptor.getName() : fieldDescriptor.getName();
 
-      if (fieldDescriptor.getAnnotations().containsKey(InfinispanAnnotations.VECTOR_ANNOTATION) && Type.FLOAT.equals(fieldDescriptor.getType())) {
+      if (fieldDescriptor.getAnnotations().containsKey(IndexAnnotations.VECTOR_ANNOTATION) && Type.FLOAT.equals(fieldDescriptor.getType())) {
          messageContext.addArrayItem(fieldPath, (Float)value);
          return;
       }
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanAnnotations.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanAnnotations.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexAnnotations.java
rename from remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanAnnotations.java
rename to remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexAnnotations.java
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanAnnotations.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexAnnotations.java	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -9,8 +9,9 @@
 import org.infinispan.api.annotations.indexing.option.VectorSimilarity;
 import org.infinispan.protostream.config.Configuration;
 import org.infinispan.protostream.descriptors.AnnotationElement;
+import org.infinispan.query.remote.impl.indexing.IndexingMetadata;
 
-public class InfinispanAnnotations {
+public class IndexAnnotations {
 
    public static final String ANNOTATIONS_OPTIONS_PACKAGE = "org.infinispan.api.annotations.indexing.option";
 
@@ -47,6 +48,14 @@
 
    public static void configure(Configuration.Builder builder) {
       builder.annotationsConfig()
+            .annotation(IndexingMetadata.INDEXED_ANNOTATION, AnnotationElement.AnnotationTarget.MESSAGE)
+               .attribute(IndexingMetadata.INDEXED_INDEX_ATTRIBUTE)
+                  .type(AnnotationElement.AttributeType.STRING)
+                  .defaultValue("")
+               .attribute(IndexAnnotations.ENABLED_ATTRIBUTE)
+                  .type(AnnotationElement.AttributeType.BOOLEAN)
+                  .defaultValue(true)
+               .metadataCreator(new IndexMetadataCreator())
             .annotation(BASIC_ANNOTATION, AnnotationElement.AnnotationTarget.FIELD)
                .attribute(NAME_ATTRIBUTE)
                   .type(AnnotationElement.AttributeType.STRING)
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanMetadataCreator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanMetadataCreator.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexFieldMetadataCreator.java
rename from remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanMetadataCreator.java
rename to remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexFieldMetadataCreator.java
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/InfinispanMetadataCreator.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexFieldMetadataCreator.java	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -12,37 +12,37 @@
 import org.infinispan.query.remote.impl.indexing.FieldMapping;
 import org.infinispan.query.remote.impl.logging.Log;
 
-public final class InfinispanMetadataCreator {
+public final class IndexFieldMetadataCreator {
 
-   private static final Log log = LogFactory.getLog(InfinispanMetadataCreator.class, Log.class);
+   private static final Log log = LogFactory.getLog(IndexFieldMetadataCreator.class, Log.class);
 
    public static FieldMapping fieldMapping(FieldDescriptor fieldDescriptor, Map<String, AnnotationElement.Annotation> annotations) {
-      AnnotationElement.Annotation fieldAnnotation = annotations.get(InfinispanAnnotations.BASIC_ANNOTATION);
+      AnnotationElement.Annotation fieldAnnotation = annotations.get(IndexAnnotations.BASIC_ANNOTATION);
       if (fieldAnnotation != null) {
          return basic(fieldDescriptor, fieldAnnotation);
       }
 
-      fieldAnnotation = annotations.get(InfinispanAnnotations.KEYWORD_ANNOTATION);
+      fieldAnnotation = annotations.get(IndexAnnotations.KEYWORD_ANNOTATION);
       if (fieldAnnotation != null) {
          return keyword(fieldDescriptor, fieldAnnotation);
       }
 
-      fieldAnnotation = annotations.get(InfinispanAnnotations.TEXT_ANNOTATION);
+      fieldAnnotation = annotations.get(IndexAnnotations.TEXT_ANNOTATION);
       if (fieldAnnotation != null) {
          return text(fieldDescriptor, fieldAnnotation);
       }
 
-      fieldAnnotation = annotations.get(InfinispanAnnotations.DECIMAL_ANNOTATION);
+      fieldAnnotation = annotations.get(IndexAnnotations.DECIMAL_ANNOTATION);
       if (fieldAnnotation != null) {
          return decimal(fieldDescriptor, fieldAnnotation);
       }
 
-      fieldAnnotation = annotations.get(InfinispanAnnotations.EMBEDDED_ANNOTATION);
+      fieldAnnotation = annotations.get(IndexAnnotations.EMBEDDED_ANNOTATION);
       if (fieldAnnotation != null) {
          return embedded(fieldDescriptor, fieldAnnotation);
       }
 
-      fieldAnnotation = annotations.get(InfinispanAnnotations.VECTOR_ANNOTATION);
+      fieldAnnotation = annotations.get(IndexAnnotations.VECTOR_ANNOTATION);
       if (fieldAnnotation != null) {
          return vector(fieldDescriptor, fieldAnnotation);
       }
@@ -53,10 +53,10 @@
    private static FieldMapping basic(FieldDescriptor fieldDescriptor, AnnotationElement.Annotation fieldAnnotation) {
       String name = name(fieldDescriptor, fieldAnnotation);
       String indexNullAs = indexNullAs(fieldAnnotation);
-      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
-      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
-      Boolean aggregable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.AGGREGABLE_ATTRIBUTE).getValue();
-      Boolean sortable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SORTABLE_ATTRIBUTE).getValue();
+      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
+      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
+      Boolean aggregable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.AGGREGABLE_ATTRIBUTE).getValue();
+      Boolean sortable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SORTABLE_ATTRIBUTE).getValue();
 
       return FieldMapping.make(fieldDescriptor, name, searchable, projectable, aggregable, sortable)
             .indexNullAs(indexNullAs)
@@ -67,16 +67,16 @@
       String name = name(fieldDescriptor, fieldAnnotation);
       String indexNullAs = indexNullAs(fieldAnnotation);
 
-      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
-      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
-      Boolean aggregable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.AGGREGABLE_ATTRIBUTE).getValue();
-      Boolean sortable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SORTABLE_ATTRIBUTE).getValue();
+      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
+      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
+      Boolean aggregable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.AGGREGABLE_ATTRIBUTE).getValue();
+      Boolean sortable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SORTABLE_ATTRIBUTE).getValue();
 
-      String normalizer = (String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.NORMALIZER_ATTRIBUTE).getValue();
+      String normalizer = (String) fieldAnnotation.getAttributeValue(IndexAnnotations.NORMALIZER_ATTRIBUTE).getValue();
       if ("".equals(normalizer)) {
          normalizer = null;
       }
-      Boolean norms = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.NORMS_ATTRIBUTE).getValue();
+      Boolean norms = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.NORMS_ATTRIBUTE).getValue();
 
       return FieldMapping.make(fieldDescriptor, name, searchable, projectable, aggregable, sortable)
             .indexNullAs(indexNullAs)
@@ -87,18 +87,18 @@
    private static FieldMapping text(FieldDescriptor fieldDescriptor, AnnotationElement.Annotation fieldAnnotation) {
       String name = name(fieldDescriptor, fieldAnnotation);
 
-      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
-      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
+      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
+      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
 
-      String analyzer = (String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.ANALYZER_ATTRIBUTE).getValue();
-      String searchAnalyzer = (String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SEARCH_ANALYZER_ATTRIBUTE).getValue();
+      String analyzer = (String) fieldAnnotation.getAttributeValue(IndexAnnotations.ANALYZER_ATTRIBUTE).getValue();
+      String searchAnalyzer = (String) fieldAnnotation.getAttributeValue(IndexAnnotations.SEARCH_ANALYZER_ATTRIBUTE).getValue();
       if ("".equals(searchAnalyzer)) {
          searchAnalyzer = null;
       }
-      Boolean norms = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.NORMS_ATTRIBUTE).getValue();
+      Boolean norms = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.NORMS_ATTRIBUTE).getValue();
 
-      TermVector termVector = InfinispanAnnotations
-            .termVector((String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.TERM_VECTOR_ATTRIBUTE).getValue());
+      TermVector termVector = IndexAnnotations
+            .termVector((String) fieldAnnotation.getAttributeValue(IndexAnnotations.TERM_VECTOR_ATTRIBUTE).getValue());
 
       return FieldMapping.make(fieldDescriptor, name, searchable, projectable, false, false)
             .text(analyzer, searchAnalyzer, norms, termVector)
@@ -109,12 +109,12 @@
       String name = name(fieldDescriptor, fieldAnnotation);
       String indexNullAs = indexNullAs(fieldAnnotation);
 
-      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
-      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
-      Boolean aggregable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.AGGREGABLE_ATTRIBUTE).getValue();
-      Boolean sortable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SORTABLE_ATTRIBUTE).getValue();
+      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
+      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
+      Boolean aggregable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.AGGREGABLE_ATTRIBUTE).getValue();
+      Boolean sortable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SORTABLE_ATTRIBUTE).getValue();
 
-      Integer decimalScale = (Integer) fieldAnnotation.getAttributeValue(InfinispanAnnotations.DECIMAL_SCALE_ATTRIBUTE).getValue();
+      Integer decimalScale = (Integer) fieldAnnotation.getAttributeValue(IndexAnnotations.DECIMAL_SCALE_ATTRIBUTE).getValue();
 
       return FieldMapping.make(fieldDescriptor, name, searchable, projectable, aggregable, sortable)
             .indexNullAs(indexNullAs)
@@ -126,17 +126,17 @@
       String name = name(fieldDescriptor, fieldAnnotation);
       String indexNullAs = indexNullAs(fieldAnnotation);
 
-      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
-      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(InfinispanAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
+      Boolean searchable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.SEARCHABLE_ATTRIBUTE).getValue();
+      Boolean projectable = (Boolean) fieldAnnotation.getAttributeValue(IndexAnnotations.PROJECTABLE_ATTRIBUTE).getValue();
 
-      Integer dimension = (Integer) fieldAnnotation.getAttributeValue(InfinispanAnnotations.DIMENSION_ATTRIBUTE).getValue();
+      Integer dimension = (Integer) fieldAnnotation.getAttributeValue(IndexAnnotations.DIMENSION_ATTRIBUTE).getValue();
       if (dimension == null) {
          throw log.dimensionAttributeRequired(name);
       }
-      VectorSimilarity similarity = InfinispanAnnotations
-            .vectorSimilarity((String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.SIMILARITY_ATTRIBUTE).getValue());
-      Integer beamWidth = (Integer) fieldAnnotation.getAttributeValue(InfinispanAnnotations.BEAM_WIDTH_ATTRIBUTE).getValue();
-      Integer maxConnection = (Integer) fieldAnnotation.getAttributeValue(InfinispanAnnotations.MAX_CONNECTIONS_ATTRIBUTE).getValue();
+      VectorSimilarity similarity = IndexAnnotations
+            .vectorSimilarity((String) fieldAnnotation.getAttributeValue(IndexAnnotations.SIMILARITY_ATTRIBUTE).getValue());
+      Integer beamWidth = (Integer) fieldAnnotation.getAttributeValue(IndexAnnotations.BEAM_WIDTH_ATTRIBUTE).getValue();
+      Integer maxConnection = (Integer) fieldAnnotation.getAttributeValue(IndexAnnotations.MAX_CONNECTIONS_ATTRIBUTE).getValue();
 
       return FieldMapping.make(fieldDescriptor, name, searchable, projectable, false, false)
             .indexNullAs(indexNullAs)
@@ -147,10 +147,10 @@
    private static FieldMapping embedded(FieldDescriptor fieldDescriptor, AnnotationElement.Annotation fieldAnnotation) {
       String name = name(fieldDescriptor, fieldAnnotation);
 
-      Integer includeDepth = (Integer) fieldAnnotation.getAttributeValue(InfinispanAnnotations.INCLUDE_DEPTH_ATTRIBUTE).getValue();
+      Integer includeDepth = (Integer) fieldAnnotation.getAttributeValue(IndexAnnotations.INCLUDE_DEPTH_ATTRIBUTE).getValue();
 
-      Structure structure = InfinispanAnnotations
-            .structure((String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.STRUCTURE_ATTRIBUTE).getValue());
+      Structure structure = IndexAnnotations
+            .structure((String) fieldAnnotation.getAttributeValue(IndexAnnotations.STRUCTURE_ATTRIBUTE).getValue());
 
       return FieldMapping.make(fieldDescriptor, name, true, false, false, false)
             .embedded(includeDepth, structure)
@@ -158,7 +158,7 @@
    }
 
    private static String name(FieldDescriptor fieldDescriptor, AnnotationElement.Annotation fieldAnnotation) {
-      String name = (String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.NAME_ATTRIBUTE).getValue();
+      String name = (String) fieldAnnotation.getAttributeValue(IndexAnnotations.NAME_ATTRIBUTE).getValue();
       if (name == null) {
          name = fieldDescriptor.getName();
       }
@@ -166,7 +166,7 @@
    }
 
    private static String indexNullAs(AnnotationElement.Annotation fieldAnnotation) {
-      String indexNullAs = (String) fieldAnnotation.getAttributeValue(InfinispanAnnotations.INDEX_NULL_AS_ATTRIBUTE).getValue();
+      String indexNullAs = (String) fieldAnnotation.getAttributeValue(IndexAnnotations.INDEX_NULL_AS_ATTRIBUTE).getValue();
       if (Values.DO_NOT_INDEX_NULL.equals(indexNullAs)) {
          indexNullAs = null;
       }
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexMetadataCreator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexMetadataCreator.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexMetadataCreator.java
new file mode 100644
--- /dev/null	(revision fc411e489800f9b570c03921698bb813f2f935fe)
+++ b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/infinispan/IndexMetadataCreator.java	(revision fc411e489800f9b570c03921698bb813f2f935fe)
@@ -0,0 +1,54 @@
+package org.infinispan.query.remote.impl.indexing.infinispan;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.infinispan.commons.logging.LogFactory;
+import org.infinispan.protostream.AnnotationMetadataCreator;
+import org.infinispan.protostream.descriptors.AnnotationElement;
+import org.infinispan.protostream.descriptors.Descriptor;
+import org.infinispan.protostream.descriptors.FieldDescriptor;
+import org.infinispan.query.remote.impl.indexing.FieldMapping;
+import org.infinispan.query.remote.impl.indexing.IndexingMetadata;
+import org.infinispan.query.remote.impl.logging.Log;
+
+//todo [anistor] Should be able to have multiple mappings per field like in Hibernate Search, ie. have a @Fields plural annotation
+
+/**
+ * {@link AnnotationMetadataCreator} for {@code @Indexed} ProtoStream annotation placed at message type level.
+ *
+ * @author anistor@redhat.com
+ * @since 7.0
+ */
+final class IndexMetadataCreator implements AnnotationMetadataCreator<IndexingMetadata, Descriptor> {
+
+   private static final Log log = LogFactory.getLog(IndexMetadataCreator.class, Log.class);
+
+   @Override
+   public IndexingMetadata create(Descriptor descriptor, AnnotationElement.Annotation annotation) {
+      Boolean enabled = (Boolean) annotation.getAttributeValue(IndexAnnotations.ENABLED_ATTRIBUTE).getValue();
+
+      String indexName = (String) annotation.getAttributeValue(IndexingMetadata.INDEXED_INDEX_ATTRIBUTE).getValue();
+      if (indexName.isEmpty()) {
+         indexName = null;
+      }
+
+      String entityAnalyzer = null;
+
+      Map<String, FieldMapping> fields = new HashMap<>(descriptor.getFields().size());
+      for (FieldDescriptor fd : descriptor.getFields()) {
+         Map<String, AnnotationElement.Annotation> annotations = fd.getAnnotations();
+
+         FieldMapping fieldMapping = IndexFieldMetadataCreator.fieldMapping(fd, annotations);
+         if (fieldMapping != null) {
+            fields.put(fd.getName(), fieldMapping);
+         }
+      }
+
+      IndexingMetadata indexingMetadata = new IndexingMetadata(enabled, indexName, entityAnalyzer, fields);
+      if (log.isDebugEnabled()) {
+         log.debugf("Descriptor name=%s indexingMetadata=%s", descriptor.getFullName(), indexingMetadata);
+      }
+      return indexingMetadata;
+   }
+}
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5Annotations.java
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5Annotations.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5Annotations.java
deleted file mode 100644
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5Annotations.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ /dev/null	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
@@ -1,95 +0,0 @@
-package org.infinispan.query.remote.impl.indexing.search5;
-
-import org.infinispan.protostream.config.Configuration;
-import org.infinispan.protostream.descriptors.AnnotationElement;
-import org.infinispan.query.remote.impl.indexing.IndexingMetadata;
-import org.infinispan.query.remote.impl.indexing.infinispan.InfinispanAnnotations;
-
-public final class Search5Annotations {
-
-   public static final String LEGACY_ANNOTATION_PACKAGE = "org.hibernate.search.annotations";
-
-   /**
-    * Similar to org.hibernate.search.annotations.Fields/Field.
-    */
-   public static final String FIELDS_ANNOTATION = "Fields";
-   public static final String FIELD_ANNOTATION = "Field";
-   public static final String FIELD_NAME_ATTRIBUTE = "name";
-   public static final String FIELD_INDEX_ATTRIBUTE = "index";
-   public static final String FIELD_ANALYZE_ATTRIBUTE = "analyze";
-   public static final String FIELD_STORE_ATTRIBUTE = "store";
-   public static final String FIELD_ANALYZER_ATTRIBUTE = "analyzer";
-   public static final String FIELD_INDEX_NULL_AS_ATTRIBUTE = "indexNullAs";
-
-   public static final String INDEX_YES = "Index.YES";
-   public static final String INDEX_NO = "Index.NO";
-
-   public static final String ANALYZE_YES = "Analyze.YES";
-   public static final String ANALYZE_NO = "Analyze.NO";
-
-   public static final String STORE_YES = "Store.YES";
-   public static final String STORE_NO = "Store.NO";
-
-   /**
-    * A marker value that indicates nulls should not be indexed.
-    */
-   public static final String DO_NOT_INDEX_NULL = "__DO_NOT_INDEX_NULL__";
-
-   /**
-    * Similar to org.hibernate.search.annotations.Analyzer. Can be placed at both message and field level.
-    */
-   public static final String ANALYZER_ANNOTATION = "Analyzer";
-   public static final String ANALYZER_DEFINITION_ATTRIBUTE = "definition";
-
-   public static final String SORTABLE_FIELD_ANNOTATION = "SortableField";
-   public static final String SORTABLE_FIELDS_ANNOTATION = "SortableFields";
-
-   public static void configure(Configuration.Builder builder) {
-      builder.annotationsConfig()
-            .annotation(IndexingMetadata.INDEXED_ANNOTATION, AnnotationElement.AnnotationTarget.MESSAGE)
-               .packageName(LEGACY_ANNOTATION_PACKAGE)
-               .attribute(IndexingMetadata.INDEXED_INDEX_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.STRING)
-                  .defaultValue("")
-               .attribute(InfinispanAnnotations.ENABLED_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.BOOLEAN)
-                  .defaultValue(true)
-               .metadataCreator(new Search5MetadataCreator())
-            .annotation(ANALYZER_ANNOTATION, AnnotationElement.AnnotationTarget.MESSAGE, AnnotationElement.AnnotationTarget.FIELD)
-               .packageName(LEGACY_ANNOTATION_PACKAGE)
-                  .attribute(ANALYZER_DEFINITION_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.STRING)
-                  .defaultValue("")
-            .annotation(FIELD_ANNOTATION, AnnotationElement.AnnotationTarget.FIELD)
-               .packageName(LEGACY_ANNOTATION_PACKAGE)
-               .repeatable(FIELDS_ANNOTATION)
-               .attribute(FIELD_NAME_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.STRING)
-                  .defaultValue("")
-               .attribute(FIELD_INDEX_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.IDENTIFIER)
-                  .packageName(LEGACY_ANNOTATION_PACKAGE)
-                  .allowedValues(INDEX_YES, INDEX_NO, IndexingMetadata.YES, IndexingMetadata.NO)
-                  .defaultValue(INDEX_YES)
-               .attribute(FIELD_ANALYZE_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.IDENTIFIER)
-                  .packageName(LEGACY_ANNOTATION_PACKAGE)
-                  .allowedValues(ANALYZE_YES, ANALYZE_NO, IndexingMetadata.YES, IndexingMetadata.NO)
-                  .defaultValue(ANALYZE_NO)  //NOTE: this differs from Hibernate Search's default which is Analyze.YES !
-               .attribute(FIELD_STORE_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.IDENTIFIER)
-                  .packageName(LEGACY_ANNOTATION_PACKAGE)
-                  .allowedValues(STORE_YES, STORE_NO, IndexingMetadata.YES, IndexingMetadata.NO)
-                  .defaultValue(STORE_NO)
-               .attribute(FIELD_ANALYZER_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.ANNOTATION)
-                  .allowedValues(ANALYZER_ANNOTATION)
-                  .defaultValue("@Analyzer(definition=\"\")")
-               .attribute(FIELD_INDEX_NULL_AS_ATTRIBUTE)
-                  .type(AnnotationElement.AttributeType.STRING)
-                  .defaultValue(DO_NOT_INDEX_NULL)
-            .annotation(SORTABLE_FIELD_ANNOTATION, AnnotationElement.AnnotationTarget.FIELD)
-               .packageName(LEGACY_ANNOTATION_PACKAGE)
-               .repeatable(SORTABLE_FIELDS_ANNOTATION);
-   }
-}
Index: remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5MetadataCreator.java
===================================================================
diff --git a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5MetadataCreator.java b/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5MetadataCreator.java
deleted file mode 100644
--- a/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/search5/Search5MetadataCreator.java	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
+++ /dev/null	(revision f0008da7301b5c316b47c1f9cce0f513dd0a20ab)
@@ -1,157 +0,0 @@
-package org.infinispan.query.remote.impl.indexing.search5;
-
-import static org.infinispan.query.remote.impl.indexing.IndexingMetadata.findAnnotation;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.infinispan.commons.logging.LogFactory;
-import org.infinispan.protostream.AnnotationMetadataCreator;
-import org.infinispan.protostream.descriptors.AnnotationElement;
-import org.infinispan.protostream.descriptors.Descriptor;
-import org.infinispan.protostream.descriptors.FieldDescriptor;
-import org.infinispan.protostream.descriptors.Type;
-import org.infinispan.query.remote.impl.indexing.FieldMapping;
-import org.infinispan.query.remote.impl.indexing.IndexingMetadata;
-import org.infinispan.query.remote.impl.indexing.infinispan.InfinispanAnnotations;
-import org.infinispan.query.remote.impl.indexing.infinispan.InfinispanMetadataCreator;
-import org.infinispan.query.remote.impl.logging.Log;
-import org.infinispan.search.mapper.mapping.impl.DefaultAnalysisConfigurer;
-
-//todo [anistor] Should be able to have multiple mappings per field like in Hibernate Search, ie. have a @Fields plural annotation
-
-/**
- * {@link AnnotationMetadataCreator} for {@code @Indexed} ProtoStream annotation placed at message type level. Also
- * handles {@code @Field} and {@code @SortableField} and {@code @Analyzer} annotations placed at field level.
- *
- * @author anistor@redhat.com
- * @since 7.0
- */
-final class Search5MetadataCreator implements AnnotationMetadataCreator<IndexingMetadata, Descriptor> {
-
-   private static final Log log = LogFactory.getLog(Search5MetadataCreator.class, Log.class);
-
-   @Override
-   public IndexingMetadata create(Descriptor descriptor, AnnotationElement.Annotation annotation) {
-      Boolean enabled = (Boolean) annotation.getAttributeValue(InfinispanAnnotations.ENABLED_ATTRIBUTE).getValue();
-
-      String indexName = (String) annotation.getAttributeValue(IndexingMetadata.INDEXED_INDEX_ATTRIBUTE).getValue();
-      if (indexName.isEmpty()) {
-         indexName = null;
-      }
-
-      String entityAnalyzer = null;
-      AnnotationElement.Annotation entityAnalyzerAnnotation = findAnnotation(descriptor.getAnnotations(), Search5Annotations.ANALYZER_ANNOTATION);
-      if (entityAnalyzerAnnotation != null) {
-         String v = (String) entityAnalyzerAnnotation.getAttributeValue(Search5Annotations.ANALYZER_DEFINITION_ATTRIBUTE).getValue();
-         if (!v.isEmpty()) {
-            entityAnalyzer = v;
-         }
-      }
-
-      Map<String, FieldMapping> fields = new HashMap<>(descriptor.getFields().size());
-      for (FieldDescriptor fd : descriptor.getFields()) {
-         Map<String, AnnotationElement.Annotation> annotations = fd.getAnnotations();
-
-         FieldMapping fieldMapping = InfinispanMetadataCreator.fieldMapping(fd, annotations);
-         if (fieldMapping != null) {
-            fields.put(fd.getName(), fieldMapping);
-            continue;
-         }
-
-         fieldMapping = search5FieldMapping(fd, annotations);
-         if (fieldMapping != null) {
-            fields.put(fd.getName(), fieldMapping);
-         }
-      }
-
-      IndexingMetadata indexingMetadata = new IndexingMetadata(enabled, indexName, entityAnalyzer, fields);
-      if (log.isDebugEnabled()) {
-         log.debugf("Descriptor name=%s indexingMetadata=%s", descriptor.getFullName(), indexingMetadata);
-      }
-      return indexingMetadata;
-   }
-
-   private static FieldMapping search5FieldMapping(FieldDescriptor fd, Map<String, AnnotationElement.Annotation> annotations) {
-      String fieldLevelAnalyzer = null;
-      AnnotationElement.Annotation fieldAnalyzerAnnotation = findAnnotation(fd.getAnnotations(), Search5Annotations.ANALYZER_ANNOTATION);
-      if (fieldAnalyzerAnnotation != null) {
-         String v = (String) fieldAnalyzerAnnotation.getAttributeValue(Search5Annotations.ANALYZER_DEFINITION_ATTRIBUTE).getValue();
-         if (!v.isEmpty()) {
-            fieldLevelAnalyzer = v;
-         }
-      }
-
-      boolean isSortable = findAnnotation(fd.getAnnotations(), Search5Annotations.SORTABLE_FIELD_ANNOTATION) != null;
-
-      AnnotationElement.Annotation fieldAnnotation = findAnnotation(fd.getAnnotations(), Search5Annotations.FIELD_ANNOTATION);
-      if (fieldAnnotation == null) {
-         return null;
-      }
-
-      String fieldName = fd.getName();
-      String v = (String) fieldAnnotation.getAttributeValue(Search5Annotations.FIELD_NAME_ATTRIBUTE).getValue();
-      if (!v.isEmpty()) {
-         fieldName = v;
-      }
-
-      AnnotationElement.Value indexAttribute = fieldAnnotation.getAttributeValue(Search5Annotations.FIELD_INDEX_ATTRIBUTE);
-      boolean isIndexed = IndexingMetadata.attributeMatches(indexAttribute, Search5Annotations.LEGACY_ANNOTATION_PACKAGE, Search5Annotations.INDEX_YES, IndexingMetadata.YES);
-
-      AnnotationElement.Value analyzeAttribute = fieldAnnotation.getAttributeValue(Search5Annotations.FIELD_ANALYZE_ATTRIBUTE);
-      boolean isAnalyzed = IndexingMetadata.attributeMatches(analyzeAttribute, Search5Annotations.LEGACY_ANNOTATION_PACKAGE, Search5Annotations.ANALYZE_YES, IndexingMetadata.YES);
-
-      AnnotationElement.Value storeAttribute = fieldAnnotation.getAttributeValue(Search5Annotations.FIELD_STORE_ATTRIBUTE);
-      boolean isStored = IndexingMetadata.attributeMatches(storeAttribute, Search5Annotations.LEGACY_ANNOTATION_PACKAGE, Search5Annotations.STORE_YES, IndexingMetadata.YES);
-
-      AnnotationElement.Value indexNullAsAttribute = fieldAnnotation.getAttributeValue(Search5Annotations.FIELD_INDEX_NULL_AS_ATTRIBUTE);
-      String indexNullAs = (String) indexNullAsAttribute.getValue();
-      if (Search5Annotations.DO_NOT_INDEX_NULL.equals(indexNullAs)) {
-         indexNullAs = null;
-      }
-
-      AnnotationElement.Annotation fieldLevelAnalyzerAnnotationAttribute = (AnnotationElement.Annotation) fieldAnnotation.getAttributeValue(Search5Annotations.FIELD_ANALYZER_ATTRIBUTE).getValue();
-      String fieldLevelAnalyzerAttribute = (String) fieldLevelAnalyzerAnnotationAttribute.getAttributeValue(Search5Annotations.ANALYZER_DEFINITION_ATTRIBUTE).getValue();
-      if (fieldLevelAnalyzerAttribute.isEmpty()) {
-         fieldLevelAnalyzerAttribute = null;
-      } else {
-         // TODO [anistor] field level analyzer attribute overrides the one specified by an eventual field level Analyzer annotation. Need to check if this is consistent with hibernate search
-         fieldLevelAnalyzer = fieldLevelAnalyzerAttribute;
-      }
-
-      // field level analyzer should not be specified unless the field is analyzed
-      if (!isAnalyzed && (fieldLevelAnalyzer != null || fieldLevelAnalyzerAttribute != null)) {
-         throw new IllegalStateException("Cannot specify an analyzer for field " + fd.getFullName() + " unless the field is analyzed.");
-      }
-
-      String analyzer = analyzer(fd.getType(), isAnalyzed, fieldLevelAnalyzer);
-      boolean sortable = sortable(analyzer, isStored, isSortable);
-      FieldMapping fieldMapping = FieldMapping.make(fd, fieldName, isIndexed, isStored, false, sortable)
-            .indexNullAs(indexNullAs)
-            .analyzer(analyzer)
-            .build();
-
-      if (log.isDebugEnabled()) {
-         log.debugf("fieldName=%s fieldMapping=%s", fieldName, fieldMapping);
-      }
-
-      return fieldMapping;
-   }
-
-   private static boolean sortable(String fieldLevelAnalyzer, boolean isStored, boolean isSortable) {
-      if (fieldLevelAnalyzer != null) {
-         return false;
-      }
-
-      return (isSortable || isStored);
-   }
-
-   private static String analyzer(Type type, boolean analyze, String fieldLevelAnalyzer) {
-      if (!Type.STRING.equals(type) || !analyze) {
-         return null;
-      }
-
-      return (fieldLevelAnalyzer != null) ? fieldLevelAnalyzer :
-            DefaultAnalysisConfigurer.STANDARD_ANALYZER_NAME;
-   }
-}
