<commit_before>from django.shortcuts import render
from django.views.generic import ListView
from django.db.models import Q

from .models import Bookmark
from taggit.models import Tag


class BookmarksList(ListView):
    model = Bookmark
    ordering = '-date_added'
    context_object_name = 'bookmarks'
    paginate_by = 20

    def get_queryset(self):
        queryset = super(BookmarksList, self).get_queryset()

        search = self.request.GET.get('search', None)

        if search:
            queryset = queryset.filter(
                Q(tags__name__contains=search) |
                Q(title__contains=search) |
                Q(description__contains=search)
            ).distinct()

        if not self.request.user.is_authenticated():
            queryset = queryset.filter(private=False)

        return queryset.prefetch_related('tags')

    def get_context_data(self, **kwargs):
        context = super(BookmarksList, self).get_context_data(**kwargs)<commit_msg>Use case insensitive comparison for search.<commit_after>from django.shortcuts import render
from django.views.generic import ListView
from django.db.models import Q

from .models import Bookmark
from taggit.models import Tag


class BookmarksList(ListView):
    model = Bookmark
    ordering = '-date_added'
    context_object_name = 'bookmarks'
    paginate_by = 20

    def get_queryset(self):
        queryset = super(BookmarksList, self).get_queryset()

        search = self.request.GET.get('search', None)

        if search:
            queryset = queryset.filter(
                Q(tags__name__icontains=search) |
                Q(title__icontains=search) |
                Q(description__icontains=search)
            ).distinct()

        if not self.request.user.is_authenticated():
            queryset = queryset.filter(private=False)

        return queryset.prefetch_related('tags')

    def get_context_data(self, **kwargs):
        context = super(BookmarksList, self).get_context_data(**kwargs)
{'fraction_non_alphanumeric': 0.09172932330827067, 'fraction_numerical': 0.0020050125313283208, 'mean_word_length': 2.875728155339806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '885318', 'n_tokens_mistral': 583, 'n_tokens_neox': 548, 'n_words': 122}