3 Replies Latest reply on Jan 31, 2012 9:17 AM by Sanne Grinovero

    Using SearchMapping in Infinispan 5.0.1

    Michael Wittig Newbie

      I want to use:

       

      SearchMapping mapping = new SearchMapping();
      mapping.entity(MyOldObject.class).indexed().providedId()
            .property("name", ElementType.METHOD).field();
      DefaultCacheManager cacheManager = new DefaultCacheManager();
      cacheManager.getDefaultConfiguration().setIndexingEnabled(true);
      cacheManager.getDefaultConfiguration().setIndexLocalOnly(true);
      cacheManager.getDefaultConfiguration().getIndexingProperties().setProperty("hibernate.search.default.directory_provider", "ram");
      cacheManager.getDefaultConfiguration().getIndexingProperties().put(Environment.MODEL_MAPPING, mapping);
      Cache<String, MyOldObject> cache = cacheManager.getCache();
      

       

      to be able to index Classes where I can't add annotations. But this doesnt work

       

      SearchFactory searchFactory = Search.getSearchManager(cache).getSearchFactory();
      DirectoryProvider[] directoryProviders = searchFactory.getDirectoryProviders(MyOldObject.class);
      

      because directoryProviders is null. So my SearchMapping is not recognized at all.

       

      How can I use Infinispan Search if I ca not annotate the classes?