Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by NoblePaul: http://wiki.apache.org/solr/DataImportHandler ------------------------------------------------------------------------------ === CachedSqlEntityProcessor === [[Anchor(cached)]] - /!\ TODO + + This is an extension of the !SqlEntityProcessor. This !EntityProcessor helps reduce the no: of DB queries executed by caching the rows. It does not help to use it in the root most entity because only one sql is run for the entity. + + Example 1. + {{{ + <entity name="x" query="select * from x"> + <entity name="y" select * from y where xid=${x.id}" processor="CachedSqlEntityProcessor"> + </entity> + <entity> + }}} + + The usage is exactly same as the other one. When a query is run the results are stored and if the same query is run again it is fetched from the cache and returned + + Example 2: + {{{ + <entity name="x" query="select * from x"> + <entity name="y" select * from y" processor="CachedSqlEntityProcessor" where="xid=x.id"> + </entity> + <entity> + }}} + + The difference with the previous one is the 'where' attribute. In this case the query fetches all the rows from the table and stores all the rows in the cache. The magic is in the 'where' value. The cache stores the values with the 'xid' value in 'y' as the key. The value for 'x.id' is evaluated every time the entity has to be run and the value is looked up in the cache an the rows are returned. + + In the where the lhs (the part before '=') is the column in y and the rhs (the part after '=') is the value to be computed for looking up the cache. + == DataSource ==
