def _compile_query(self):
<EOL>query = []<EOL>for key, val, is_escaped in self._solr_query:<EOL><INDENT>if key == '<STR_LIT:key>':<EOL><INDENT>key = '<STR_LIT>'<EOL><DEDENT>elif key == '<STR_LIT>':<EOL><INDENT>key = '<STR_LIT>'<EOL><DEDENT>elif key[:<NUM_LIT:5>] == '<STR_LIT>':  <EOL><INDENT>key = '<STR_LIT>' + key[<NUM_LIT:5>:]<EOL><DEDENT>elif key[:<NUM_LIT:6>] == '<STR_LIT>':  <EOL><INDENT>key = '<STR_LIT>' + key[<NUM_LIT:6>:]<EOL><DEDENT>key, val, is_escaped = self._process_query_val(key, val, is_escaped)<EOL>if key == '<STR_LIT>':<EOL><INDENT>key = '<STR_LIT>'<EOL>val = '<STR_LIT>'.join(<EOL>['<STR_LIT>' % self._parse_query_key(*self._process_query_val(k, v, is_escaped)) for<EOL>k, v in val.items()])<EOL>is_escaped = True<EOL><DEDENT>elif key.endswith('<STR_LIT>'):<EOL><INDENT>if not val:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>key = key[:-<NUM_LIT:4>]<EOL>val = '<STR_LIT>'.join(<EOL>['<STR_LIT>' % (key, self._escape_query(v, is_escaped)) for v in val])<EOL>if key.startswith('<STR_LIT:->'):<EOL><INDENT>val = '<STR_LIT>' % val<EOL><DEDENT>key = '<STR_LIT>'<EOL>is_escaped = True<EOL><DEDENT>key, val = self._parse_query_key(key, val, is_escaped)<EOL>if key == '<STR_LIT>':<EOL><INDENT>self.want_deleted = True<EOL><DEDENT>key = key.replace('<STR_LIT>', '<STR_LIT:.>')<EOL>if key == '<STR_LIT>':<EOL><INDENT>query.append("<STR_LIT>" % val)<EOL><DEDENT>else:<EOL><INDENT>query.append("<STR_LIT>" % (key, val))<EOL><DEDENT><DEDENT>if len(query) == <NUM_LIT:1>:<EOL><INDENT>q = query[<NUM_LIT:0>]<EOL>if q.startswith('<STR_LIT:->'):<EOL><INDENT>query[<NUM_LIT:0>] = '<STR_LIT>' % q<EOL><DEDENT>if q[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>query[<NUM_LIT:0>] = '<STR_LIT>' % q[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>joined_query = self._QUERY_GLUE.join(query)<EOL>if not self.want_deleted:<EOL><INDENT>if joined_query:<EOL><INDENT>joined_query = "<STR_LIT>" % joined_query<EOL><DEDENT>else:<EOL><INDENT>joined_query = '<STR_LIT>'<EOL><DEDENT><DEDENT>elif not joined_query:<EOL><INDENT>joined_query = '<STR_LIT>'<EOL><DEDENT>self.compiled_query = joined_query<EOL>
Builds SOLR query and stores it into self.compiled_query