Пример #1
0
def remove_trailing_empty_segments():
    """
    Removes empty segments from the end of any text section.
    """
    texts = model.VersionSet()
    for text in texts:
        if not model.Ref.is_ref(text.title):
            continue # Ignore text versions we don't understand
        new_text = rtrim_jagged_string_array(deepcopy(text.chapter))
        if new_text != text.chapter:
            print text.title + " CHANGED"
            text.chapter = new_text
            text.save()
            update_counts(text.title)
Пример #2
0
anaBekhoach = model.Index().load({'title': 'Ana BeKhoach'})
anaBekhoach.categories = [u'Liturgy',u'Piyutim'] #why doesn't update() work on an instance?
anaBekhoach.save()

model.IndexSet({"title":{"$regex": "Rabbah?"}}).update({"categories": ['Midrash', 'Aggadic Midrash', 'Midrash Rabbah']})
#this one should not have been updated.
model.Index().update({'title': 'Tanna Debei Eliyahu Rabbah'}, {'categories': ['Midrash', 'Aggadic Midrash']})

model.IndexSet({'title': {"$regex" : 'Ein Yaakov'}}).update({'categories': ['Midrash', 'Aggadic Midrash']})

model.Index().update({'title': 'Midrash Tanchuma'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Legends of the Jews'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Midrash Mishlei'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Pirkei Derabi Eliezer'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Midrash on Proverbs'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': "Midrash B'not Zelophehad"}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Midrash Tehilim'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Pesikta de rav kahana'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'The Fathers according to Rabbi Nathan'}, {'categories': ['Midrash', 'Aggadic Midrash']})
model.Index().update({'title': 'Yalkut Shimoni'}, {'categories': ['Midrash', 'Aggadic Midrash']})


model.Index().update({'title': 'Sifra'}, {'categories': ['Midrash', 'Halachic Midrash']})
model.Index().update({'title': "Mekhilta d'Rabbi Yishmael"}, {'categories': ['Midrash', 'Halachic Midrash']})
model.Index().update({'title': 'Mekhilta'}, {'categories': ['Midrash', 'Halachic Midrash']})
model.Index().update({'title': 'Sifre Bamidbar'}, {'categories': ['Midrash', 'Halachic Midrash']})


# Rebuild counts docs, so they get the allVersionCounts field
update_counts()
update_summaries()
Пример #3
0
def rebuild_counts_and_toc(request):
    update_counts()
    update_summaries()
    return HttpResponseRedirect("/?m=Counts-&-TOC-Rebuilt")
Пример #4
0
def reset_counts(request):
    update_counts()
    return HttpResponseRedirect("/?m=Counts-Rebuilt")
Пример #5
0
def reset_counts(request):
    update_counts()
    return HttpResponse("Counts & Cache Reset")
from sefaria.counts import update_counts

# Remove duplicate 'Sefer Abudraham'

db.index.remove({"title": "Sefer Abudraham "})
db.index.remove({"title": "Tiferet Yisrael "})
db.index.remove({"title": "Igrot Moshe "})
db.index.remove({"title": "The Sabbath, Heschel  "})
db.index.remove({"title": "Sifre Devarim "})

remove_old_counts()

texts = model.IndexSet({})
for t in texts:
    if t.title != t.title.strip():
        t.title = t.title.strip()
        t.save()

ns = model.NoteSet({"public": {"$exists": False}})
for n in ns:
    if not getattr(n, "owner", None):
        n.owner = 1

ns.update({"public": False})

# Remove "sectionCounts" field form sectionCounts
db.counts.update({}, {"$unset": {"sectionCounts": ""}}, multi=True)

# Rebuild counts docs, so they get the allVersionCounts field
update_counts()
Пример #7
0
def reset_counts(request):
    update_counts()
    return HttpResponse("Counts & Cache Reset")