comparison PostgreSQL/Plugins/PostgreSQLIndex.cpp @ 20:aacb651833f5

merge
author am@osimis.io
date Tue, 10 Jul 2018 11:08:19 +0200
parents 38e23471d132 9e419261f1c9
children 4f66bc893fc3
comparison
equal deleted inserted replaced
19:38e23471d132 20:aacb651833f5
127 * https://www.postgresql.org/docs/current/static/pgtrgm.html 127 * https://www.postgresql.org/docs/current/static/pgtrgm.html
128 * https://bitbucket.org/sjodogne/orthanc/issues/47/index-improvements-for-pg-plugin 128 * https://bitbucket.org/sjodogne/orthanc/issues/47/index-improvements-for-pg-plugin
129 **/ 129 **/
130 try 130 try
131 { 131 {
132 LOG(WARNING) << "Trying to enable trigram matching on the PostgreSQL database to speed up wildcard searches. This may take several minutes"; // we've observed 9 minutes on DB with 100000 studies 132 // We've observed 9 minutes on DB with 100000 studies
133 LOG(WARNING) << "Trying to enable trigram matching on the PostgreSQL database "
134 << "to speed up wildcard searches. This may take several minutes";
135
133 db->Execute( 136 db->Execute(
134 "CREATE EXTENSION pg_trgm; " 137 "CREATE EXTENSION pg_trgm; "
135 "CREATE INDEX DicomIdentifiersIndexValues2 ON DicomIdentifiers USING gin(value gin_trgm_ops);"); 138 "CREATE INDEX DicomIdentifiersIndexValues2 ON DicomIdentifiers USING gin(value gin_trgm_ops);");
136 139
137 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 1); 140 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 1);
138 LOG(WARNING) << "Trigram index has been created"; 141 LOG(WARNING) << "Trigram index has been created";
139 } 142 }
140 catch (Orthanc::OrthancException&) 143 catch (Orthanc::OrthancException&)
141 { 144 {
142 LOG(WARNING) << "Performance warning: Your PostgreSQL server does not support trigram matching"; 145 LOG(WARNING) << "Performance warning: Your PostgreSQL server does "
143 LOG(WARNING) << "-> Consider installing the \"pg_trgm\" extension on the PostgreSQL server, e.g. on Debian: sudo apt install postgresql-contrib"; 146 << "not support trigram matching";
147 LOG(WARNING) << "-> Consider installing the \"pg_trgm\" extension on the "
148 << "PostgreSQL server, e.g. on Debian: sudo apt install postgresql-contrib";
144 } 149 }
145 } 150 }
146 151
147 if (revision != 1) 152 if (revision != 1)
148 { 153 {