2.4. Uploaded Files Content Search

Take the following steps to see the example of uploaded files content search: add the workflow base project, add EBook entity to the project and create and complete the book scanning workflow as described in the Workflow subsystem guide (see Additional Materials). Further in this section it is assumed that the application already has an instance of EBook and that a file with the original book has already been uploaded as a result of the Book scanning process execution.

Add the following elements to the project’s fts.xml file:

...
        <entity class="com.sample.library.entity.EBook">
            <include name="publication.book"/>
            <include name="attachments.file"/>
        </entity>

        <entity class="com.haulmont.workflow.core.entity.CardAttachment" show="false">
            <include re=".*"/>
            <exclude name="card"/>

            <searchables>
                searchables.add(entity.card)
            </searchables>
        </entity>

    </entities>
</fts-config>

In order for search results screen to display the EBook instances properly, you should add @NamePattern annotation to the EBook class:

@NamePattern("%s|publication")
public class EBook extends Card {
...

After that, restart the application server. Open the JMX Console screen, open the app-core.fts:type=FtsManager JMX bean and invoke sequentially reindexAll() and processQueue() to re-index the existing instances in the database and files according to the new search configuration. All new and changed data will be indexed automatically with a delay depending on the scheduled task interval, i.e. not longer than 30 seconds.

As a result, if the database contains a book called Alice’s Adventures with an original PDF available, search results for "alice" will look like this:

SearchResults2

Search results for "rabbit" will look like this:

SearchResults3