public function query($query, $offset = 0, $limit = 20, $params = array(), $andWith = array()) {
		if (is_string($query)) {
			$builder = $this->getQueryBuilder('default');
			$builder->baseQuery($query);
			$query = $builder;
		}
		// be very specific about the subsite support :). 
		if (ClassInfo::exists('Subsite')) {
			$query->andWith('SubsiteID_i', Subsite::currentSubsiteID());
		}

		// add the stage details in - we should probably use an extension mechanism for this,
		// but for now this will have to do. @TODO Refactor this....
		$stage = Versioned::current_stage();
		if (!$stage && !(isset($params['ignore_stage']) && $params['ignore_stage'])) {
			// default to searching live content only
			$stage = 'Live';
		}

		if(!isset($params['ignore_stage']) || !$params['ignore_stage']) {
			$query->addFilter('SS_Stage_ms', $stage);
		}

		if($andWith) {
			foreach($andWith as $field => $value) {
				$query->andWith($field, $value);
			}
		}

		$extraParams = $query->getParams();
		$params = array_merge($params, $extraParams);

		$query = $query->toString();

		$response = null;
		$rawResponse = null;
		$solr = $this->getSolr();
		$key = null;
		if ($this->cache) {
			$key = md5($query.$offset.$limit.serialize($params));
			if ($rawResponse = $this->cache->load($key)) {
				$response = new Apache_Solr_Response(
					$rawResponse, 
					// we fake the following headers... :o
					array(
						'HTTP/1.1 200 OK',
						'Content-Type: text/plain; charset=utf-8'
					), 
					$solr->getCreateDocuments(), 
					$solr->getCollapseSingleValueArrays()
				);
			}
		}
		if (!$response) {

			// Execute the query and log any errors on failure, always displaying the search results to the user.

			if ($this->isConnected()) {
				try {
					$response = $this->getSolr()->search($query, $offset, $limit, $params);
				}
				catch(Exception $e) {
					SS_Log::log($e, SS_Log::WARN);
				}
			}
		}
		
		$queryParams = new stdClass();
		$queryParams->offset = $offset;
		$queryParams->limit = $limit;
		$queryParams->params = $params;

		$results = new SolrResultSet($query, $response, $queryParams, $this);
		
		if ($this->cache && !$rawResponse && $key && $response) {
			$this->cache->save($response->getRawResponse(), $key, array(), $this->cacheTime);
		}

		return $results;
	}