Skip to content

Commit d28f637

Browse files
authored
docs: Add README describing Solr custom schema changes for Solr 9.x.x version config (#537)
1 parent c0af91c commit d28f637

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

docker/docker-compose-solr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
cp -r $$TECHPRODUCTS_CONFIGSET $$SITECORE_CONFIGSET
3737
3838
# Override with pysolr-specific configset configuration
39-
cp -r $$PYSOLR_CONFIGSET/. $$SITECORE_CONFIGSET/conf
39+
cp $$PYSOLR_CONFIGSET/solrconfig.xml $$SITECORE_CONFIGSET/conf/solrconfig.xml
4040
4141
# Rename managed-schema.xml to schema.xml
4242
mv "$$SITECORE_CONFIGSET/conf/managed-schema.xml" "$$SITECORE_CONFIGSET/conf/schema.xml"

docker/scripts/solr-init.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo "Solr init starting ..."
55

66
echo "Preparing sitecore_configset..."
77
cp -r "$TECHPRODUCTS_CONFIGSET" "$SITECORE_CONFIGSET"
8-
cp -r "$PYSOLR_CONFIGSET"/. "$SITECORE_CONFIGSET/conf"
8+
cp "$PYSOLR_CONFIGSET/solrconfig.xml" "$SITECORE_CONFIGSET/conf/solrconfig.xml"
99

1010
# Rename managed-schema.xml to schema.xml before uploading the configset to ZooKeeper
1111
mv "$SITECORE_CONFIGSET/conf/managed-schema.xml" "$SITECORE_CONFIGSET/conf/schema.xml"
@@ -19,4 +19,5 @@ curl -fsS \
1919
"http://solr-node0:8983/solr/admin/collections?action=CREATE&name=$SOLR_COLLECTION_NAME&numShards=1&replicationFactor=2&collection.configName=sitecore_configset&createNodeSet=solr-node0:8983_solr,solr-node1:8983_solr"
2020

2121
echo "Collection '$SOLR_COLLECTION_NAME' created successfully."
22+
2223
echo "Solr init completed."
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Solr 9 Config Notes
2+
3+
**Directory:** `docker/solr_configs/9.x.x`
4+
5+
This directory contains Solr configuration files customized specifically for
6+
**pysolr test requirements**.
7+
8+
These files are based on Solr 9 defaults, with a small number of intentional
9+
changes. If this configuration needs to be updated for a future Solr version
10+
(e.g. Solr 10), please make sure the customizations documented below are
11+
preserved.
12+
13+
---
14+
15+
## schema.xml
16+
17+
We do **not** maintain a separate `schema.xml` file here.
18+
19+
Originally, `schema.xml` was just a renamed copy of Solr’s default
20+
`managed-schema.xml`.
21+
22+
Instead of duplicating it, the Docker/compose scripts now **rename**
23+
`<CORE>/conf/managed-schema.xml` to `<CORE>/conf/schema.xml` before Solr starts.
24+
25+
This avoids maintaining two equivalent schema files and keeps the source of
26+
truth aligned with upstream Solr defaults.
27+
28+
---
29+
30+
## solrconfig.xml
31+
32+
There are **two intentional changes** compared to the default Solr configuration:
33+
34+
### 1. ClassicIndexSchemaFactory
35+
36+
```xml
37+
<schemaFactory class="ClassicIndexSchemaFactory" />
38+
```
39+
40+
This tells Solr to use `schema.xml` instead of `managed-schema.xml`.
41+
Using `schema.xml` is preferred because it is **immutable at runtime**.
42+
43+
**Source location:**
44+
[ClassicIndexSchemaFactory configuration](https://github.com/django-haystack/pysolr/blob/fa3457b4b3de44c053128052c9dc61282a2f9021/docker/solr_configs/9.x.x/solrconfig.xml#L37)
45+
46+
**Solr documentation:**
47+
[Solr 9 Schema Factories – ClassicIndexSchemaFactory](https://solr.apache.org/guide/solr/9_9/configuration-guide/schema-factory.html#schema-factories)
48+
49+
---
50+
51+
### 2. MoreLikeThis request handler
52+
53+
```xml
54+
<requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />
55+
```
56+
57+
This request handler is **not enabled by default** in Solr, but several pysolr
58+
test cases depend on it.
59+
60+
**Source location:**
61+
[MoreLikeThis request handler configuration](https://github.com/django-haystack/pysolr/blob/fa3457b4b3de44c053128052c9dc61282a2f9021/docker/solr_configs/9.x.x/solrconfig.xml#L615)
62+
63+
**Solr documentation:**
64+
[Solr 9 MoreLikeThis query handler](https://solr.apache.org/guide/solr/9_9/query-guide/morelikethis.html)
65+
66+
---
67+
68+
## Notes for Future Solr Versions
69+
70+
When upgrading to a new Solr major version (e.g. Solr 10):
71+
72+
- Create a new versioned directory, e.g. `docker/solr_configs/10.x.x`
73+
- Start from the **upstream default `solrconfig.xml`** for that Solr version
74+
- Re-apply the two changes documented above
75+
- Keep schema handling via `schema.xml` + `ClassicIndexSchemaFactory`
76+
- Ensure the `/mlt` request handler remains enabled
77+
78+
This README exists to avoid losing these details during future upgrades.

0 commit comments

Comments
 (0)