In my custom plugin, I have AO objects for reading data currently I am hitting the database to get data, instead of hitting database is there a way for me to query index to read data. If so, how do I query index. I would hoping this approach will be light on the performance. any thoughts or suggestion on this?
The index is still stored in the database, and the query planner will use an index when it looks like it would make sense.
Remember that DB indices don’t really store the underlying record, just pointers and partial data stored in a way that makes sense when it needs to search for rows.
If you really want to write your own queries, you can inject org.ofbiz.core.entity.jdbc.ReadOnlySQLProcessor
using ComponentAccessor
and create your native queries, but then you’ll have to parse their results: AO won’t do the mapping for you.
thanks, this helps