Просмотр исходного кода

Merge pull request #14215 from ChillarAnand/whoosh

fix: Use whoosh AsyncWriter to prevent write locks
version-14
gavin 3 лет назад
committed by GitHub
Родитель
Сommit
06c1d79bb0
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
1 измененных файлов: 4 добавлений и 2 удалений
  1. +4
    -2
      frappe/search/full_text_search.py

+ 4
- 2
frappe/search/full_text_search.py Просмотреть файл

@@ -8,6 +8,8 @@ from whoosh.index import create_in, open_dir, EmptyIndexError
from whoosh.fields import TEXT, ID, Schema
from whoosh.qparser import MultifieldParser, FieldsPlugin, WildcardPlugin
from whoosh.query import Prefix
from whoosh.writing import AsyncWriter


class FullTextSearch:
""" Frappe Wrapper for Whoosh """
@@ -75,7 +77,7 @@ class FullTextSearch:
ix = self.get_index()

with ix.searcher():
writer = ix.writer()
writer = AsyncWriter(ix)
writer.delete_by_term(self.id, document[self.id])
writer.add_document(**document)
writer.commit(optimize=True)
@@ -135,4 +137,4 @@ class FullTextSearch:
return out

def get_index_path(index_name):
return frappe.get_site_path("indexes", index_name)
return frappe.get_site_path("indexes", index_name)

Загрузка…
Отмена
Сохранить