'Find entries (req/res).'

def find_request_response(self, widget=None, refresh=False):

    searchText = self._searchText.get_text()
    searchText = searchText.strip()
    searchData = []
    if searchText:
        likePieces = [('url', (('%' + searchText) + '%'), 'like'), ('tag', (('%' + searchText) + '%'), 'like')]
        searchData.append((likePieces, 'OR'))
    codes = self.pref.get_options('codes')
    filterCodes = []
    for opt in codes:
        if opt.get_value():
            codef = opt.get_name()
            filterCodes.append(('codef', int(codef[0]), '='))
    searchData.append((filterCodes, 'OR'))
    try:
        minId = int(self.pref.get_value('trans_id', 'min'))
    except:
        minId = 0
    try:
        maxId = int(self.pref.get_value('trans_id', 'max'))
    except:
        maxId = 0
    if (maxId > 0):
        searchData.append(('id', maxId, '<'))
    if (minId > 0):
        searchData.append(('id', minId, '>'))
    if refresh:
        searchData.append(('id', self._lastId, '>'))
    if self.pref.get_value('sizes', 'resp_size'):
        searchData.append(('response_size', 0, '>'))
    if self.pref.get_value('misc', 'tag'):
        searchData.append(('tag', '', '!='))
    if self.pref.get_value('misc', 'has_qs'):
        searchData.append(('has_qs', 0, '>'))
    filterTypes = []
    for filterType in self._filterTypes:
        if self.pref.get_value('types', filterType[0]):
            filterTypes.append(('content_type', (('%' + filterType[0]) + '%'), 'like'))
    searchData.append((filterTypes, 'OR'))
    filterMethods = []
    for method in self._filterMethods:
        if self.pref.get_value('methods', method[0]):
            filterTypes.append(('method', method[0], '='))
    searchData.append((filterMethods, 'OR'))
    try:
        searchResultObjects = self._historyItem.find(searchData, result_limit=5001, orderData=[('id', '')])
    except BaseFrameworkException as w3:
        self._empty_results()
        return
    if (len(searchResultObjects) == 0):
        if (not refresh):
            self._empty_results()
        return
    elif (len(searchResultObjects) > 5000):
        self._empty_results()
        msg = ((_('The    search    you    performed    returned    too    many    results    (') + str(len(searchResultObjects))) + ').\n')
        msg += _('Please    refine    your    search    and    try    again.')
        self._show_message('Too    many    results', msg)
        return
    else:
        lastItem = searchResultObjects[(-1)]
        self._lastId = int(lastItem.id)
        self._show_list_view(searchResultObjects, appendMode=refresh)
        self._sw.set_sensitive(True)
        self._req_res_viewer.set_sensitive(True)
        if (not refresh):
            self._lstoreTreeview.set_cursor((0,))
        return
