Skip to content

Commit

Permalink
remove elasticsearch integration
Browse files Browse the repository at this point in the history
  • Loading branch information
zombified committed Nov 26, 2024
1 parent e2012a3 commit 82434d2
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 74 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Changelog
=========

3.0.0b147 (unreleased)
3.1.0b1 (unreleased)
----------------------

- Nothing changed yet.
- remove elasticsearch integration


3.0.0b146 (2024-10-17)
Expand Down
11 changes: 5 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ In addition to Plone standard features, CastleCMS includes:
- Advanced content layout editor
- Improved management toolbar
- Intuitive content creation and organization
- Elasticsearch integration
- Opensearch integration
- Search results tuned by social media impact
- Search results pinning
- Celery task queue integration (asynchronous actions)
Expand Down Expand Up @@ -79,20 +79,20 @@ Dependencies

- Redis
- avconv (needs to be updated for ffmpeg again)
- ElasticSearch 2.3
- Opensearch 1.1+


Development setup on macOS
--------------------------

1. ``brew install redis elasticsearch libav python``
1. ``brew install redis opensearch libav python``
2. ``git clone [email protected]:castlecms/castle.cms.git``
3. ``cd castle.cms``
4. ``virtualenv -p python2.7 .``
5. ``bin/pip install --upgrade pip``
6. ``bin/pip install -r requirements.txt``
7. ``bin/buildout``
8. Run (in separate terminal windows) ``elasticsearch``, ``redis-server``, ``bin/instance fg``
8. Run (in separate terminal windows) ``opensearch``, ``redis-server``, ``bin/instance fg``
9. Browse to http://localhost:8080/

Once you have created a site in the development instance:
Expand All @@ -106,7 +106,6 @@ Optional Dependencies
---------------------

- Install `argon2_cffi` to use more secure password hashing.
- https://github.com/castlecms/elasticsearch-castle-scoring
- https://github.com/castlecms/castlehps for faster search integration
- Amazon S3 credentials to store large files on S3
- Google API keys for Google analytics and Recaptcha integrations
Expand Down Expand Up @@ -147,7 +146,7 @@ Running local dependencies with docker

or, just the essentials:
$ docker run -p 6379:6379 redis
$ docker run -p 9200:9200 elasticsearch:2.4-alpine
$ docker run -p 9200:9200 opensearchproject/opensearch:latest


Forks/Custom releases
Expand Down
1 change: 0 additions & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ auto-checkout =
[sources]
plone.app.mosaic = git [email protected]:castlecms/plone.app.mosaic.git branch=castlecms-5.0.x
collective.celery = git [email protected]:collective/collective.celery.git branch=master
# collective.elasticsearch = git [email protected]:collective/collective.elasticsearch.git
collective.documentviewer = git [email protected]:collective/collective.documentviewer.git branch=master
castle.theme = git [email protected]:castlecms/castle.theme.git branch=master
collective.easyform = git [email protected]:collective/collective.easyform.git
Expand Down
4 changes: 2 additions & 2 deletions castle/cms/cron/_social_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from AccessControl.SecurityManagement import newSecurityManager
from Acquisition import aq_parent
from BTrees.OOBTree import OOBTree
from castle.cms.indexing.hps import index_in_es
# from castle.cms.indexing.hps import index_in_es
from castle.cms.social import COUNT_ANNOTATION_KEY
from castle.cms.utils import clear_object_cache, retriable
from plone.app.redirector.interfaces import IRedirectionStorage
Expand Down Expand Up @@ -214,7 +214,7 @@ def get_social_counts(site, obj, site_url, count_types, count=0):

transaction.commit()

index_in_es(obj)
# index_in_es(obj)

if count % 200 == 0:
clear_object_cache(site)
Expand Down
6 changes: 4 additions & 2 deletions castle/cms/cron/_twitter_monitor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from AccessControl.SecurityManagement import newSecurityManager
from BTrees.OOBTree import OOBTree
from castle.cms.indexing.hps import index_in_es
# from castle.cms.indexing.hps import index_in_es
from castle.cms.services import twitter
from castle.cms.social import COUNT_ANNOTATION_KEY
from castle.cms.utils import retriable
Expand Down Expand Up @@ -82,7 +82,9 @@ def parse_line(site, public_url, line):
record_tweet_stats(site, ob, tweet)
if modified:
transaction.commit()
index_in_es()
# this method is supposed to get an 'obj' as a parameter, so I'm not confident this
# was working before we removed ES
# index_in_es()


class StreamListener(twitter.StreamListener):
Expand Down
9 changes: 0 additions & 9 deletions castle/cms/indexing/hps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from wildcard.hps.opensearch import WildcardHPSCatalog
from zope.component import getMultiAdapter
from zope.component import getUtility
from collective.elasticsearch.es import ElasticSearchCatalog
from collective.elasticsearch.hook import index_batch


logger = logging.getLogger("Plone")
Expand Down Expand Up @@ -158,13 +156,6 @@ def gen_audit_query(
return query


def index_in_es(obj):
catalog = api.portal.get_tool('portal_catalog')
es = ElasticSearchCatalog(catalog)
if es.enabled:
index_batch([], {IUUID(obj): obj}, [], es)


def get_index_summary(index_name, terms, agg_agg_terms=None, filter_terms=None):
query = {
"size": 0,
Expand Down
7 changes: 0 additions & 7 deletions castle/cms/interfaces/layers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# IElasticSearchLayer ensures that if collective.elasticsearch is installed
# as an addon in a site, that the "search" view is overridden correctly by castle.cms
# this should be considered deprecated behavior, and will be removed in a
# future release.
from collective.elasticsearch.interfaces import IElasticSearchLayer

from plone.app.contenttypes.interfaces import IPloneAppContenttypesLayer
from plone.app.mosaic.interfaces import IMosaicLayer
from plone.app.tiles.interfaces import ITilesFormLayer
Expand All @@ -17,7 +11,6 @@ class ICastleLayer(
IMosaicLayer,
ITilesFormLayer,
IPloneAppContenttypesLayer,
IElasticSearchLayer, # included to ensure compatibility, see note by import
IWildcardHPSLayer):
pass

Expand Down
38 changes: 0 additions & 38 deletions docker-compose.yml

This file was deleted.

6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def read(*rnames):
name='castle.cms',
description='CastleCMS Plone distribution main package',
long_description_content_type='text/x-rst',
version='3.0.0b147.dev0',
version='3.1.0b1.dev0',
long_description='%s\n%s' % (
read('README.rst'),
read('CHANGES.md')
Expand Down Expand Up @@ -66,10 +66,6 @@ def read(*rnames):
'wildcard.hps>=1.4.0',
'collective.celery>=1.1.4',

# the use of collective.elasticsearch in the 3.x+ version of castle.cms
# is limited and should not be relied on.
'collective.elasticsearch >=4.0.0, <5.0.0',

# python
'boto3>=1.9.222',
'google-api-python-client >=1.4.2, <2',
Expand Down
2 changes: 0 additions & 2 deletions versions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Products.ATContentTypes = 2.2.14+wc.1

# addons
collective.celery = 1.1.4
collective.elasticsearch = 4.0.0
collective.documentviewer = 5.0.4
wildcard.readonly = 1.0
repoze.catalog = 0.8.3
Expand All @@ -66,7 +65,6 @@ anyjson = 0.3.3
billiard = 3.5.0.4
cachetools = 2.0.0
celery = 4.2.1
elasticsearch = 7.6.0
kombu = 4.2.1
urllib3 = 1.25.3
plone.formwidget.multifile = 1.1
Expand Down

0 comments on commit 82434d2

Please sign in to comment.