FTS Not indexing related entities properly

We are just about to role FTS out in production and I noticed a strange scenario which could be a deal breaker if a solution isn’t found.

Here are some sections of our fts.xml:

<entity class="com.company.njuns.entity.Ticket">
    <include name="ticketId"/>
    <include name="ticketNumber"/>
    ...
    <include name="wallEntries"/>
</entity> 

<entity class="com.company.njuns.entity.TicketWallEntry" show="false">
    <include name="comment"/>
    ...
</entity>

Our ticket entity references the TicketWallEntry collection through the wallEntries property. The issue is that when I add a new TicketWallEntry, I confirm that the index processes the change in scheduled tasks, but when I try to search using content from the comment of the TicketWallEntry I get a message saying nothing found. It’s not until I save the ticket again that the FTS will be able to find the ticket based on the TicketWallEntry.comment field. Make Sense?

Basically I want FTS to help me find tickets when I create new TicketWallEntry items against the ticket but it doesn’t work until I update the ticket.

Anything I can do here to help the index without having to redundantly save the ticket every time?

Thanks.

Hi Josh,

What is the CUBA version?

The current version we are using for FTS is 6.10.4.

Hi Josh,

I’ll try to reproduce the error and answer you later.

Thank you. After some more testing, it works fine with entities that are COMPOSITION entities on Ticket, but TicketWallEntry is not a COMPOSITION entity and it doesn’t work the same way. To get around the issue for now I added a SQL database trigger that adds another row to the SYS_FTS_QUEUE table as a ticket update whenever a ticket wall entry is added/updated and this appears to work for now as a work around.

Hi Josh,

In that case you can add tag <searchables> for TicketWallEntry e.g.

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

From the documentation:
searchables - a Groovy script to add arbitrary entities associated with the changed one to the indexing queue.

For example, when a CardAttachment instance is either added or removed, the associated Card instance should also be re-indexed. The reason is that the Card instance itself will not be added to the queue, as it has not been changed (it stores a collection of CardAttachment instances). Thus it will not be shown in search results if matching data is found in its linked entity - a newly added `CardAttachment.

https://doc.cuba-platform.com/fts-6.10/fts_config.html