allocate correct buffer size for search query caching