Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,35 @@ stack-rm: ## Local Stack: Remove Services and Volumes
@echo "Remove local volume data"
@docker volume rm $(PROJECT_NAME)_vol-site-data

####################################################
## Solr Development Support
####################################################

.PHONY: solr-start
solr-start: ## Start solr
@echo "Start solr"
$(COMPOSE_DEV) up -d solr

.PHONY: solr-start-and-rebuild
solr-start-and-rebuild: ## Start solr, force rebuild
@echo "Start solr, force rebuild, erases data"
$(COMPOSE_DEV) up -d --build solr

.PHONY: solr-stop
solr-stop: ## Stop solr
@echo "Stop solr"
$(COMPOSE_DEV) down solr

.PHONY: solr-logs
solr-logs: ## Show solr logs
@echo "Show solr logs"
$(COMPOSE_DEV) logs -f solr

.PHONY: solr-activate-and-reindex
solr-activate-and-reindex: ## Activate solr and reindex
@echo "Activate solr and reindex"
$(MAKE) -C "./backend/" solr-activate-and-reindex

####################################################
## Acceptance
####################################################
Expand Down
5 changes: 5 additions & 0 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ build-image: ## Build Docker Images
@echo "$(GREEN)==> Building $(IMAGE_NAME_PREFIX)-acceptance:$(IMAGE_TAG) $(RESET)"
@docker build . --pull=false --platform linux/amd64 -t $(IMAGE_NAME_PREFIX)-acceptance:$(IMAGE_TAG) -f Dockerfile.acceptance --build-arg IMAGE_TAG=$(IMAGE_TAG) --build-arg SEED=$(SEED)

# Solr
.PHONY: solr-activate-and-reindex
solr-activate-and-reindex: $(VENV_FOLDER) instance/etc/zope.conf ## Activate solr and reindex
@uv run zconsole run instance/etc/zope.conf ./scripts/solr_activate_and_reindex.py

# Acceptance tests
.PHONY: acceptance-backend-start
acceptance-backend-start: ## Start backend acceptance server
Expand Down
1 change: 1 addition & 0 deletions backend/news/108.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Solr startup scripts for development. @ericof
1 change: 1 addition & 0 deletions backend/news/191.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for an autocomplete livesearch widget @reebalazs
7 changes: 5 additions & 2 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"pas.plugins.authomatic==2.0.0",
"pas.plugins.keycloakgroups==1.0.0b1",
"pas.plugins.oidc==2.0.0",
"kitconcept.solr==2.0.0a1",
"kitconcept.solr==2.0.0a2",
]

[dependency-groups]
Expand All @@ -61,6 +61,9 @@ container = [
"zeo==6.0.0",
]

[tool.hatch.metadata]
allow-direct-references = true

[project.urls]
Homepage = "https://github.com/kitconcept/kitconcept.intranet"
PyPI = "https://pypi.python.org/pypi/kitconcept.intranet"
Expand Down Expand Up @@ -289,7 +292,7 @@ constraint-dependencies = [
"jsonschema==4.24.0",
"keyring==25.6.0",
"kitconcept.core==1.0.0a30",
"kitconcept.solr==2.0.0a1",
"kitconcept.solr==2.0.0a2",
"kitconcept.voltolighttheme==7.0.0b5",
"legacy-cgi==2.6.2",
"lockfile==0.12.2",
Expand Down
28 changes: 28 additions & 0 deletions backend/scripts/solr_activate_and_reindex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from kitconcept.solr.reindex_helpers import activate_and_reindex
from plone import api
from Products.GenericSetup.tool import SetupTool
from Testing.makerequest import makerequest
from zope.component.hooks import site

import sys
import transaction


if __name__ == "__main__":
"""Activate and reindex Solr for the Plone site."""

app = makerequest(globals()["app"])

# Set site to Plone
site_id = "Plone"
portal = app.unrestrictedTraverse(site_id)
with site(portal):
setup_tool: SetupTool = api.portal.get_tool("portal_setup")
version = setup_tool.getLastVersionForProfile("kitconcept.intranet:solr")
if version == "unknown":
print("Solr is not configured for this Plone site.")
else:
with transaction.manager as tm:
activate_and_reindex(portal, clear="--clear" in sys.argv)
tm.note("Activated and reindexed Solr.")
app._p_jar.sync()
2 changes: 2 additions & 0 deletions backend/src/kitconcept/intranet/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def handler(distribution: Distribution, site: PloneSite, answers: dict) -> Plone
if workflow == "restricted":
profiles["base"].append("kitconcept.intranet:restricted")
if answers.get("setup_solr", False):
# Explicitly add Solr profiles
profiles["base"].append("kitconcept.solr:default")
profiles["base"].append("kitconcept.intranet:solr")
distribution._profiles = profiles
site = default_handler(distribution, site, answers)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<records interface="collective.solr.interfaces.ISolrSchema"
prefix="collective.solr"
>
<value key="use_tika">True</value>
</records>
</registry>
1 change: 1 addition & 0 deletions backend/tests/creation/solr/test_solr_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_profile_installed(self, profile_last_version, profile_id):
["collective.solr.host", "127.0.0.1"],
["collective.solr.port", 8983],
["collective.solr.base", "/solr/plone"],
["collective.solr.use_tika", True],
],
)
def test_registry_keys(self, key, expected):
Expand Down
Loading
Loading