Not really an answer to the technical side of your question, but a reflection on the hosting market.
Shared hosting is not meant to be used for high-performance or special needs. It's an extremely streamlined service for the people using very standard software like Wordpress, Drupal or static HTML. This is the harsh truth. You may be able to find a workaround but do not expect it to be portable or even perform well. Shared hosting is meant to leverage an extremely cheap hosting solution for those times you don't need performance and features.
The real solution is to get dedicated hosting for your needs. You may consider a VPS which is usually cheaper, or putting only the search engine in another cloud service (for example, try Google Custom Search).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…