protected function buildCountQuery(EntityManager $em, Request $request)
	{
		$searchWords = preg_split('/[^[:alnum:]]+/', $request->getSearchText());
		$selects = array();
		foreach($this->databaseMapping as $tableMapping)
		{
			$score = $this->buildScoreColumn($tableMapping['columns'], count($searchWords));
			$joinsExpressions = $this->buildJoinExpressions($tableMapping['joins']);

			$selects[] = 'SELECT COUNT(*) '
					. 'FROM ' . $tableMapping['table'] . ' ' . $tableMapping['tableAlias'] . ' '
					. implode(' ', $joinsExpressions) . ' '
					. 'WHERE ' . $score['expression'] . '<>0 '
			;
		}
		$bigSelect = 'SELECT (' . implode(')+(', $selects) . ')';
		$stmt = $em->getConnection()->prepare($bigSelect);
		foreach($searchWords as $key => $searchWord)
		{
			$stmt->bindValue('p' . $key, $searchWord);
		}
		return $stmt;
	}