we use SOLR as main search engine, and used modules in Drupal side in HEDI-CMS project to index documents in SOLR and in current project (HEDI-APP) we request SOLR (url is stored as SOLR_URL variable in .env.local
file to find matching documents (entities).
This is a number between 0.0 and 1.0 to show how a daterange is with other daterange values intersected. 1.0 means total intersect. 0.0 means no intersect. 0.33 means 33% of intersection.
to setup local machine to be able to develop/compile/... the project, this tools should be installed a. using https://code.visualstudio.com/docs/java/java-tutorial
b.
- openjdk-11-jdk:
- Linux:
sudo apt install default-jdk
. Then the directory /usr/lib/jvm/java-11-openjdk-amd64/ contains the jdk. - MacOS: TODO
- Linux:
- install
Language Support for Java(TM) by Red Hat
extension for VSCode. - config JDK path in VSCode settings:
- press Ctrl+Shift+P and type
Java: Configure Java Runtime
- download/configure jdk. for my linux system it's: /usr/lib/jvm/java-11-openjdk-amd64
- I had a problem with this settings and had downloaded the jdk using this settings-box but jdk-path was unknown; the problem was solved after installing default-jdk.
- press Ctrl+Shift+P and type
- restart VSCode
- install mvn to be able to compile maven project
- Linux:
sudo apt install maven
- MacOS: TODO
- Linux:
- $ docker cp HEDI_CMS_solr:/var/solr/data/search/conf/solrconfig.xml ./patches/solrconfig-server.xml
- backup current solrconfig.xml of server (only for the first time)
- $ mv ./patches/solrconfig-server.xml ./patches/solrconfig-search.xml
- create a copy of server file to run a patch on it
- $ patch -N ./patches/solrconfig-search.xml ./patches/solrconfig-search.patch
- patch the changes in the copy config file
- $ docker cp ./patches/solrconfig-search.xml HEDI_CMS_solr:/var/solr/data/search/conf/solrconfig.xml
NOTE: this copies the file under root user of container.
TODO
: use current user instead
- $ mvn package
- this compiles the project and creates a jar file in target folder:
./target/hedi-solr-utils-2.0.jar
. the name of the file may vary if you have changed the version value in pom.xml file.
- this compiles the project and creates a jar file in target folder:
- $
docker cp ./target/hedi-solr-utils-2.0.jar HEDI_CMS_solr:/opt/solr-8.11.1/hedi/
-- give correct permissions: $docker exec -it --user root HEDI_CMS_solr bash
$chown root:root ./hedi/hedi-solr-utils-2.0.jar
- from solr core admin Reload the solr
- $ mvn package && docker cp ./target/hedi-solr-utils-2.0.jar HEDI_CMS_solr:/opt/solr-8.11.1/hedi/ && docker exec -it --user root HEDI_CMS_solr chown root:root ./hedi/hedi-solr-utils-2.0.jar
- from solr core admin Reload the solr
- $
docker cp ./patches/solrconfig-server.xml HEDI_CMS_solr:/var/solr/data/search/conf/solrconfig.xml
- restore old solrconfig.xml version
- $
docker exec -it --user root HEDI_CMS_solr bash
- #
rm ./dist/hedi-solr-utils-\*.jar
- #
solr restart
- #
exit
- from solr core admin Reload the solr
For more detailed documentation on solr funcionalities, also see SOLR-README.
signiture
intersectRatio(START_DATE_AS_STRING, END_DATE_AS_STRING, DATERANGE_FIELD_TO_BE_SEARCHED_IN)
sample 1.
fl=*,score, intersectRatio:intersectRatio("2022-01-10T22:00:00Z", "2022-03-05T11:00:00Z", "drm_field_event_daterange")
in this sample we have used intersectRatio function in fl (result fields list) to show the value in result. we have used intersectRatio as alias for this new result field. drm_field_event_daterange is the name of the field with daterange values
sample 2
q={!frange l=0.33 u=1.0}intersectRatio("2021-10-10T22:00:00Z", "2022-03-03T22:00:00Z", "drm_field_event_daterange")
to find items (profiles) with equal or more than 33% of intersectRatio.
sample 3
fq={!frange l=0.33 u=1.0}intersectRatio("2021-10-10T22:00:00Z", "2022-03-03T22:00:00Z", "drm_field_event_daterange")
to filter items (profiles) with equal or more than 33% of intersectRatio.
signiture
hasMonthlyCapacity(ET_AS_STRING, PREGNANCY_DATES_FIELD_NAME, CAPACITY_FIELD_NAME)
sample 1.
fl=*,score, hasMonthlyCapacity:hasMonthlyCapacity("2023-01-10T22:00:00Z","expected_delivery_dates","care_capacity")
- $ docker exec -it --user root HEDI_CMS_solr bash
- # solr restart