PyCharm 2019.1.1 Not Searching Project Correctly

Answered

I have been noticing poor searching capability lately in PyCharm, but this image kind of proves there is an issue. I am searching the whole project for 'property_choices" and there are 6 occurrences in the file in the background yet the search functionality finds nothing.... is there anything that can be done to fix this or am I out of luck? This is one of the main reasons I like using this IDE

 

1
6 comments

Well downgrading to a previous release fixed my issue, but that issue still seems silly. 

0

Please try PyCharm 2019.1.3 (https://www.jetbrains.com/pycharm/download)

If the issue is still reproduced in the latest version, can you provide a sample .py file and indicate the phrase that cannot be found? We would try to reproduce locally.

0

I did upgrade and the issue persists with 2019.1.3. I search for

Group.DoesNotExist

which is clearly in the page in the background, and nothing is found. However, when I copied the text directly after cleaning up the comments it randomly worked though. I am not sure what the issue is but it does seem like there could be a bug.

I don't seem to be able to attach a file to the comment, but here is the code from the file, it could not find Group.DoesNotExist:

from django.contrib import messages
from django.contrib.auth.models import Group
from django.shortcuts import render, redirect
from django.urls import reverse

from apps.authentication.decorators import permissions_required
from apps.groups.forms.GroupForm import GroupForm
from apps.properties.models.property_models import Property
from utils.other.logging_and_print_helpers import display_exception, log
from utils.other.pagination import paginated_results


@permissions_required('auth.view_group')
def index(request, client_url):
    groups = Group.objects.all().order_by('name').exclude(name='admin')

    return render(request, 'groups/index.html', {
        'groups': paginated_results(request, groups)
    })


@permissions_required('auth.change_group')
def edit_group(request, client_url, group_id):
    try:
        group = Group.objects.get(id=group_id)
    except Group.DoesNotExist as ex:
        log(ex, display_exception(), request=request)
        messages.error(request, 'Group does not exist')
        return redirect(reverse('groups_index', args=[client_url]))

    form = GroupForm(request.POST, instance=group)

    # print(Property.objects.exclude(id__in=[prop.id for prop in request.user.staff.allowed_properties.all()]))

    return render(request, 'groups/edit.html', {
        'form': form,
        'group': group
    })
0

I'm not denying the possibility of a bug, but unfortunately I could not reproduce it. Tried on Windows and Linux builds of PyCharm 2019.1.3

Can it be that your project is in the process of indexing while the issue is reproduced? Is your background task list empty? (Window > Background task > Show)

0
Avatar
Permanently deleted user

Since I have the same problem but only in a few of my projects and not all maybe I could help narrow down the issue.

I myself have multiple source roots in my project which should not matter but quite a lot of files (total 10098, 2216 *.py with pycache and tox, 764 without). I could imagine that you would need a project of an unknown amount of complexity to get this bug. Even reinitializing and removing cache ecetera ecetera does not help or until the IDE is restarted one time. I could try and find a "big" project in github in which I have the same problem since my project is not open, but as far as I tested it is not repoduceable in small projects or single files.
The problem occurs not only while searching with [STRG][SHIFT][F] and [SHIFT][SHIFT] but also on find usage. Pycharm is still able to jump to the implementation of a referenced function but not able to reverse jump to a place where this function is used.

0

R Tiersch

Please see https://youtrack.jetbrains.com/issue/PY-48089#focus=Comments-27-4844159.0-0

As a workaround in 2021.1, you can use File | Invalidate Caches / Restart... | Invalidate and Restart.

0

Please sign in to leave a comment.