<commit_before>import datetime
from haystack import indexes
from models import Recipe

class RecipeIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    author = indexes.CharField(model_attr='author')
    course = indexes.CharField(model_attr='course')
    cuisine = indexes.CharField(model_attr='cuisine')
    pub_date = indexes.DateTimeField(model_attr='pub_date')


    def get_model(self):
        return Recipe

    def index_queryset(self, using=None):
        """Used when the entire index for the recipe model is updated"""
        return self.get_model(shared=Recipe.SHARE_SHARED, pub_date__lte=datetime.datetime.now()) #only index shared recipes no private<commit_msg>updated search to only show shared with new haystack format<commit_after>import datetime
from haystack import indexes
from models import Recipe

class RecipeIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    author = indexes.CharField(model_attr='author')
    course = indexes.CharField(model_attr='course')
    cuisine = indexes.CharField(model_attr='cuisine')
    pub_date = indexes.DateTimeField(model_attr='pub_date')


    def get_model(self):
        return Recipe.SHARE_SHARED

    def index_queryset(self, using=None):
        """Used when the entire index for the recipe model is updated"""
        return self.get_model(pub_date__lte=datetime.datetime.now()) #only index shared recipes no private
{'fraction_non_alphanumeric': 0.0915726609157266, 'fraction_numerical': 0.0, 'mean_word_length': 4.9604743083003955, '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': '7453245', 'n_tokens_mistral': 442, 'n_tokens_neox': 423, 'n_words': 109}