springload / wagtaildraftail

🐦📝🍸 Draft.js editor for Wagtail, built upon Draftail and draftjs_exporter
https://pypi.python.org/pypi/wagtaildraftail
MIT License
24 stars 3 forks source link

DraftailTextBlock to be searchable #24

Closed dnsl48 closed 7 years ago

dnsl48 commented 7 years ago

Currently DraftTextBlock returns its JSON stuff as the searchable content. We want it to be the rendered document instead.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.1%) to 9.783% when pulling cdd10204c2b1588e15033d4c44d3f7dbcfa7e21d on feature/block_to_be_searchable into ae5a43aea21aa429ad9dbb8f6b9f5599a469700c on master.

loicteixeira commented 7 years ago

It's a bit of a bummer that we have to render the html to then strip it but I don't see how else it can be done. The JSON structure doesn't seem very easy to traverse.

Would DraftailTextField need the same fix?

dnsl48 commented 7 years ago

Yes, the text field implementation should be updated as well. I'm also going to implement some tests. Will be doing things within this PR.

dnsl48 commented 7 years ago

About having to render the content first - it's not a biggie, since wagtail database search backend doesn't support extra fields anyways, whereas Elasticsearch takes the stuff from fields only once - at the indexing stage (it's either on model update, or even in a celery/cron background job)

loicteixeira commented 7 years ago

Will add tests as part of in #27.