Skip to content

Commit

Permalink
Merge pull request #4 from Sh1nku/v0.3.2
Browse files Browse the repository at this point in the history
v0.3.2: Fix error when using Solr 8.0-8.5
  • Loading branch information
Sh1nku authored Aug 22, 2023
2 parents 8c3c866 + 0c65ac3 commit 172f939
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
python-version: [ "3.8", "3.11" ]
docker-version: [ "8_11", "9_3" ]
docker-version: [ "8_0", "8_11", "9_3" ]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
docker-version: [ "8_11", "9_3" ]
docker-version: [ "8_0", "8_11", "9_3" ]
steps:
- uses: actions/checkout@v3
- name: Update Rust
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# v0.3.2
* `num_found_exact` was introduced in Solr 8.6. This caused deserialization to fail on older versions.
Changed so that it will be emulated as `true` for older versions.

# v0.3.1
* Fix error in python documentation
*
# v0.3.0
* Add Facet sets
* Add Json facets
Expand Down
5 changes: 5 additions & 0 deletions docker/8_0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM solr:8.0.0

COPY security.json security.json
COPY solr-security.sh /usr/bin/solr-security.sh
ENTRYPOINT ["/usr/bin/solr-security.sh"]
35 changes: 35 additions & 0 deletions docker/8_0/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3'
services:
zoo1:
image: zookeeper:3.4
hostname: zoo1
volumes:
- 'zoo1_data:/data'
environment:
ZOO_MY_ID: 1
ZOO_PORT: 2181
ZOO_SERVERS: 'server.1=0.0.0.0:2888:3888'
ports:
- "2181:2181"
restart: unless-stopped
solr1:
build:
context: .
hostname: solr1
ports:
- "8983:8983"
volumes:
- 'solr1_varsolr:/var/solr'
environment:
ZK_HOST: 'zoo1'
SOLR_JAVA_MEM: "-Xms1g -Xmx1g"
restart: unless-stopped
speedbump:
image: kffl/speedbump:latest
ports:
- "8984:8984"
command: --latency 2s --port 8984 solr1:8983
restart: unless-stopped
volumes:
zoo1_data:
solr1_varsolr:
13 changes: 13 additions & 0 deletions docker/8_0/security.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"authentication":{
"blockUnknown": true,
"class":"solr.BasicAuthPlugin",
"credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}
},
"authorization":{
"class":"solr.RuleBasedAuthorizationPlugin",
"permissions":[{"name":"security-edit",
"role":"admin"}],
"user-role":{"solr":"admin"}
}
}
3 changes: 3 additions & 0 deletions docker/8_0/solr-security.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
solr zk cp /opt/solr-8.0.0/security.json zk:security.json -z zoo1:2181
exec /opt/docker-solr/scripts/docker-entrypoint.sh -f "$@"
5 changes: 5 additions & 0 deletions docker/9_0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM solr:9.0.0

COPY security.json security.json
COPY solr-security.sh /usr/bin/solr-security.sh
ENTRYPOINT ["/usr/bin/solr-security.sh"]
35 changes: 35 additions & 0 deletions docker/9_0/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3'
services:
zoo1:
image: zookeeper:3.4
hostname: zoo1
volumes:
- 'zoo1_data:/data'
environment:
ZOO_MY_ID: 1
ZOO_PORT: 2181
ZOO_SERVERS: 'server.1=0.0.0.0:2888:3888'
ports:
- "2181:2181"
restart: unless-stopped
solr1:
build:
context: .
hostname: solr1
ports:
- "8983:8983"
volumes:
- 'solr1_varsolr:/var/solr'
environment:
ZK_HOST: 'zoo1'
SOLR_JAVA_MEM: "-Xms1g -Xmx1g"
restart: unless-stopped
speedbump:
image: kffl/speedbump:latest
ports:
- "8984:8984"
command: --latency 2s --port 8984 solr1:8983
restart: unless-stopped
volumes:
zoo1_data:
solr1_varsolr:
13 changes: 13 additions & 0 deletions docker/9_0/security.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"authentication":{
"blockUnknown": true,
"class":"solr.BasicAuthPlugin",
"credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}
},
"authorization":{
"class":"solr.RuleBasedAuthorizationPlugin",
"permissions":[{"name":"security-edit",
"role":"admin"}],
"user-role":{"solr":"admin"}
}
}
3 changes: 3 additions & 0 deletions docker/9_0/solr-security.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
solr zk cp /opt/solr-9.0.0/security.json zk:security.json -z zoo1:2181
exec /opt/solr-9.0.0/docker/scripts/docker-entrypoint.sh -f "$@"
2 changes: 1 addition & 1 deletion framework/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "solrstice"
description = "A Solr 8+ client"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
license = "MIT OR Apache-2.0"
keywords = ["solr", "search"]
Expand Down
7 changes: 6 additions & 1 deletion framework/src/models/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ pub struct SolrResponseError {
pub code: usize,
}

fn default_true() -> bool {
true
}

/// Documentation response from Solr. The docs are not immediately deserialized to allow for reading the other fields first.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct SolrDocsResponse {
Expand All @@ -40,7 +44,8 @@ pub struct SolrDocsResponse {
/// The start index of the documents.
pub(crate) start: usize,
#[serde(rename = "numFoundExact")]
/// Whether or not the number of documents found is exact.
/// Whether or not the number of documents found is exact. This field only exists on Solr 8.6+. On older versions, this will always be true.
#[serde(default = "default_true")]
pub(crate) num_found_exact: bool,
/// The documents returned by the query. Use [`SolrDocsResponse::get_docs`] to deserialize.
docs: Box<RawValue>,
Expand Down
1 change: 0 additions & 1 deletion test_setup/test_collection/managed-schema
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<fieldType name="pdate" class="solr.DatePointField" docValues="true"/>
<fieldType name="pdates" class="solr.DatePointField" docValues="true" multiValued="true"/>
<fieldType name="binary" class="solr.BinaryField"/>
<fieldType name="rank" class="solr.RankField"/>
<fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
<fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/>

Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solrstice-py"
version = "0.3.1"
version = "0.3.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/solrstice/response.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SolrDocsResponse:
def get_start(self) -> int:
"""Get the start index of the query"""
def get_num_found_exact(self) -> bool:
"""Get whether the number of documents found is exact"""
"""Get whether the number of documents found is exact. This field only exists on Solr 8.6+. On older versions, this will always be true."""
def get_docs(self) -> List[Dict[str, Any]]:
"""Get the documents from the query"""

Expand Down

0 comments on commit 172f939

Please sign in to comment.