FTS not searching on id field

Hi,

I want FTS to search entity (UUID based persistent entity that extends StandardEntity) by its id (uuid).

Although in fts.xml, search pattern says re=".*" search based on UUID just does not work. I also tried including and here id is auto suggested by Intellij IDE only. But search on id still don’t work.

Thanks

Hi,
By default, system properties (like id, version, createTs, etc are not indexed by FTS). If you need to change this behavior, you can override the com.haulmont.fts.core.sys.ConfigLoader bean and its isSearchableProperty(…) method.

Thanks Max,

I understand that its intended behaviour and overriding will work for me.

Only 1 more thing. When I override it, in which xml I have to point it use my custom class instead of the default ConfigLoader?

The ConfigLoader class is located in the core module, so you should override this bean in the spring.xml file in your core module

Can I get some more information on how to do this? I also need to search by UUID, but I’m not understanding the instructions.

Thanks,
Adam

I’ve attempted to get this working by creating a new bean and extending ConfigLoader, then I recreated the isSearchableProperty method with the @Override annotation, and then change the system properties section to return true, but the app fails to load the login screen and says that core module failed to start. Am I doing this all wrong, or have I simply missed a step?

Thanks,
Adam

Hi,
all you need to do is to create a new class that extends the ConfigLoader, e.g.:

public class ExtConfigLoader extends ConfigLoader {

    @Override
    protected boolean isSearchableProperty(MetaProperty metaProperty) {
        if (Arrays.binarySearch(systemProps, metaProperty.getName()) >= 0)
            return true;
        return super.isSearchableProperty(metaProperty);
    }
}

and to register the bean in the spring.xml:

    <bean id="fts_ConfigLoader" class="com.company.sample.core.sys.ExtConfigLoader"/>

The sample project: cuba-fts-id.zip (89.3 KB)

2 Likes

Thank you Max. I really appreciate the example. It appears I was including the standard pieces when creating a new bean like the @Component annotation. Somewhere along the way it got in the way of the file functioning correctly. Thanks again!