-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODNOTES-163 Support search by title and content (#163)
- Loading branch information
Showing
10 changed files
with
100 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
stages: | ||
- name: Build | ||
steps: | ||
- runScriptConfig: | ||
image: maven:3-openjdk-11 | ||
shellScript: mvn package -DskipTests | ||
- name: Build Docker with DIND | ||
steps: | ||
- publishImageConfig: | ||
dockerfilePath: ./Dockerfile | ||
buildContext: . | ||
tag: docker.dev.folio.org/mod-notes:spitfire-latest | ||
pushRemote: true | ||
registry: docker.dev.folio.org | ||
- name: Deploy | ||
steps: | ||
- applyAppConfig: | ||
catalogTemplate: p-9tp2k:spitfire-helmcharts-mod-notes | ||
version: 0.1.32 | ||
answers: | ||
image.repository: docker.dev.folio.org/mod-notes | ||
image.tag: spitfire-latest | ||
name: mod-notes | ||
targetNamespace: spitfire | ||
timeout: 60 | ||
notification: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/resources/templates/db_scripts/create_note_search_column.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ALTER TABLE note_data ADD COLUMN IF NOT EXISTS search_content text; | ||
|
||
CREATE INDEX search_content_idx_gin ON note_data USING gin (search_content public.gin_trgm_ops); | ||
|
||
CREATE OR REPLACE FUNCTION update_search_content() | ||
RETURNS TRIGGER AS $$ | ||
BEGIN | ||
NEW.search_content = f_unaccent(coalesce(NEW.jsonb->>'title','') || ' ' | ||
|| regexp_replace( | ||
regexp_replace( | ||
coalesce(NEW.jsonb->>'content',''), | ||
E'<[^>]+>', '', 'gi' | ||
), | ||
'\n+', ' ', 'gi' | ||
)); | ||
RETURN NEW; | ||
END; | ||
$$ language 'plpgsql'; | ||
|
||
DROP TRIGGER IF EXISTS update_search_content ON note_data; | ||
|
||
CREATE TRIGGER update_search_content | ||
BEFORE INSERT OR UPDATE ON note_data | ||
FOR EACH ROW EXECUTE PROCEDURE update_search_content(); | ||
|
||
UPDATE note_data SET jsonb = jsonb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters