cancel
Showing results for 
Search instead for 
Did you mean: 

use @cds.search with target entity (aka deep search)

jdombrow
Explorer

I'm currently implementing a search functionality that will search through properties of my main entity but also through that of associated entites.

According to the CAP documentation, this will be achieved through @cds.search annotation, by referencing the target entity as following:

@cds.search: {
     element1,         // included
     accoc1,           // extend to searchable elements in target entity
     accoc2.elementA   // extend to a specific element in target entity  
}   

see Documentation for reference.

But it doesn't seem to work.
I'm on NodeJS stack, and tested it locally as well as on HANA Cloud (BTP).

I found the following thread where it was stated by arley.trianamorin that deep search was only supported for Java stack. (March '21)

We are using sap/cds version 5.9.0 and sap/cds-dk version 4.9.0

Is the deep search functionality still unsupported for the nodeJS stack?
Are there any plans to support this in the near future?

Thanks and best regards!

View Entire Topic
Arley
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear Juliane,

Unfortunately, deep search is still not supported today (1. April 2022).
There are plans to support this feature in the future. Perhaps johannesvogel can comment on that.

Kind regards,
Arley

carlonnheim
Participant

Hi,

Would be great to know if there is a target timeline for this feature. Also if there are any suggested workarounds until then. For "to one" associations I usually bring the underlying data field forward in the service projections, which effectively makes it searchable. "to many" associations are more tricky though...

Thanks!

//Carl

jdombrow
Explorer
0 Kudos

Hey Arley,

thanks for your quick reply.

I can only agree with Carl's comment - as I have basically the same question about any guess what the target timeline here is.

Doing this manually at service level seems seems to me like a performance issue in the making, so a solution at database level is definitely desirable.

Thanks and best regards,

Juliane

johannesvogel
Advisor
Advisor
0 Kudos

Hi Carl and Juliane,

there are no plans to implement that in the near future.

Best regards,

Johannes

carlonnheim
Participant

Hi johannesvogel,

Thanks for the clear direction, albeit not what we hoped for. Can we contribute to make it happen quicker? Seems not too far away by relaxing the criteria here:

and putting something recursive here

to get it to generate nested "... OR EXISTS (select ... subquery from association entity ...)" together with the other generated search criteria.

Would you consider taking a PR if I do some work on it? I need this for a project with a timeline towards the summer, and getting the query into the DB layer is probably the only decent performing approach I would think. Is the Java source available for reference?

Regards

//Carl

johannesvogel
Advisor
Advisor
0 Kudos

Hi Carl,

thank you very much for the offer.

Unfortunately, we are about to refactor our database service implementation, it does not make sense to us to implement that now.

After the refactoring it'll be much easier for us to implement it.

As you have a deadline in summer, I'd suggest to do that manually in a custom handler using the "search" property of the CQN in combination with the annotation.

Best regards,

Johannes

sergei-u-niq
Active Contributor

Hi johannesvogel is there any news on this one?

Thanks, Sergei

johannesvogel
Advisor
Advisor

Hi Sergei,

we are currently working on a pre-condition for this feature, namely filtering on associations on sqlite.

If that's done, we can start with this feature.

Best regards,

Johannes