diff --git a/Dockerfile b/Dockerfile index 9f89509d7..a8011cbf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.5 ENV BUILD_PACKAGES postgresql-dev graphviz-dev graphviz build-base git pkgconfig \ python3-dev libxml2-dev jpeg-dev libressl-dev libffi-dev libxslt-dev nodejs py3-lxml \ -py3-magic postgresql-client poppler-utils antiword vim +py3-magic postgresql-client poppler-utils antiword vim curl jq RUN apk --update add fontconfig ttf-dejavu && fc-cache -fv diff --git a/docker-compose.yml b/docker-compose.yml index 1e779f4a6..7b19be74d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,32 +1,57 @@ -sapldb: - image: postgres - restart: always - environment: - POSTGRES_PASSWORD: sapl - POSTGRES_USER: sapl - POSTGRES_DB: sapl - PGDATA : /var/lib/postgresql/data/ - volumes: - - sapldb_data:/var/lib/postgresql/data/ - ports: - - "5432:5432" -sapl: - image: interlegis/sapl:3.1.104 - restart: always - environment: - ADMIN_PASSWORD: interlegis - ADMIN_EMAIL: email@dominio.net - DEBUG: 'False' - USE_TLS: 'False' - EMAIL_PORT: 587 - EMAIL_HOST: smtp.dominio.net - EMAIL_HOST_USER: usuariosmtp - EMAIL_HOST_PASSWORD: senhasmtp - TZ: America/Sao_Paulo - volumes: - - sapl_data:/var/interlegis/sapl/data - - sapl_media:/var/interlegis/sapl/media - links: - - sapldb - ports: - - "80:80" +version: '2' +services: + sapldb: + image: postgres:9.6.8-alpine + restart: always + environment: + POSTGRES_PASSWORD: sapl + POSTGRES_USER: sapl + POSTGRES_DB: sapl + PGDATA : /var/lib/postgresql/data/ + volumes: + - sapldb_data:/var/lib/postgresql/data/ + ports: + - "5432:5432" + + saplsolr: + image: solr:7.4-alpine + restart: always + volumes: + - solr_data:/opt/solr/server/solr + - solr_configsets:/opt/solr/server/solr/configsets + ports: + - "8983:8983" + + sapl: + image: interlegis/sapl:3.1.106-ALPHA + # build: . + restart: always + environment: + ADMIN_PASSWORD: interlegis + ADMIN_EMAIL: email@dominio.net + DEBUG: 'False' + USE_TLS: 'False' + EMAIL_PORT: 587 + EMAIL_HOST: smtp.dominio.net + EMAIL_HOST_USER: usuariosmtp + EMAIL_HOST_PASSWORD: senhasmtp + SOLR_URL: http://saplsolr:8983/solr/sapl + TZ: America/Sao_Paulo + volumes: + - sapl_data:/var/interlegis/sapl/data + - sapl_media:/var/interlegis/sapl/media + - sapl_root:/var/interlegis/sapl + volumes_from: + - saplsolr + depends_on: + - sapldb + - saplsolr + ports: + - "80:80" +volumes: + sapldb_data: + sapl_data: + sapl_media: + sapl_root: + solr_data: + solr_configsets: diff --git a/docker_solr_init.py b/docker_solr_init.py new file mode 100755 index 000000000..1573eba53 --- /dev/null +++ b/docker_solr_init.py @@ -0,0 +1,120 @@ + +import requests +import logging +import subprocess +import sys + + +class SolrClient: + + # TODO: allow HTTPS and custom port + STATUS_CORE = "{}://{}:{}/solr/admin/cores?action=STATUS&core={}&wt=json" + EXISTS_CORE = "{}://{}:{}/solr/{}/admin/ping?wt=json" + OPTIMIZE_CORE = "{}://{}:{}/solr/{}/update?optimize=true" + CREATE_CORE = "{}://{}:{}/solr/admin/cores?action=CREATE&name={}&configSet=sapl_configset" + DELETE_CORE = "{}://{}:{}/solr/admin/cores?" \ + "action=UNLOAD&core={}&deleteIndex=true&deleteDataDir=true&deleteInstanceDir=true" + DELETE_DATA = "{}://{}:{}/solr/{}/update?commitWithin=1000&overwrite=true&wt=json" + + def __init__(self, address='localhost', port=8983, protocol='http'): + self.protocol = protocol + self.address = address + self.port = port + + def status_core(self, core_name): + req_url = self.STATUS_CORE.format(self.protocol, self.address, self.port, core_name) + return requests.post(req_url).json() + + def exists_core(self, core_name): + req_url = self.EXISTS_CORE.format(self.protocol, self.address, self.port, core_name) + res = requests.get(req_url) + return True if res.ok else False + + def create_core(self, core_name): + + # UPLOAD configset + subprocess.call(['cp', '-rv', './solr/sapl_configset', '/opt/solr/server/solr/configsets']) + + req_url = self.CREATE_CORE.format(self.protocol, + self.address, + self.port, + core_name) + + res = requests.post(req_url) + if res.ok: + print("Core '%s' created succesfully" % core_name) + else: + print("Error creating core '%s'" % core_name) + as_json = res.json() + print("Error %s: %s" % (res.status_code, as_json['error']['msg'])) + return False + return True + + def optimize_core(self, core_name): + req_url = self.OPTIMIZE_CORE.format(self.protocol, self.address, self.port, core_name) + res = requests.get(req_url) + if not res.ok: + print("Error optimizing core '{}'".format(core_name)) + print("Code {}: {}".format(res.status_code, res.text)) + else: + print("Core '{}' optimized successfully!".format(core_name)) + + def delete_core(self, core_name): + req_url = self.DELETE_CORE.format(self.protocol, self.address, self.port, core_name) + res = requests.post(req_url) + if not res.ok: + print("Error optimizing core '%s'", core_name) + print("Code {}: {}".format(res.status_code, res.text)) + else: + print("Core '%s' deleted successfully!" % core) + + def delete_data(self, core_name): + req_url = self.DELETE_DATA.format(self.protocol, self.address, self.port, core_name) + res = requests.post(req_url, + data='*:*', + headers={'Content-Type': 'application/xml'}) + if not res.ok: + print("Error deleting index for core '%s'", core_name) + print("Code {}: {}".format(res.status_code, res.text)) + else: + print("Core '%s' data deleted successfully!" % core_name) + + data = self.status_core(core_name) + prefix = data['status'][core_name]['index'] + print("Num docs: %s" % prefix['numDocs']) + print("Delete docs: %s" % prefix['deletedDocs']) + + +if __name__ == '__main__': + + args = sys.argv + if len(args) < 2: + print("Usage: python3 docker_solr_init.py ") + sys.exit(-1) + core = args[1] + + client = SolrClient() + if len(args) == 3: + hostname = args[2] + client = SolrClient(address=hostname) + + if not client.exists_core(core): + print("Core '%s' doesn't exists. Creating a new one..." % core) + created = client.create_core(core) + + if created: + core_data = client.status_core(core) + + if len(core_data['status'][core]) == 0: + print("Error getting core '%s', status: '%s'" % (core, core_data['initFailures'][core])) + else: + print("Performing a full reindex of '%s' core..." % core) + p = subprocess.call(["python3", "manage.py", "rebuild_index --noinput"]) + client.optimize_core(core) + + num_docs = core_data['status'][core]['index']['numDocs'] + print("Docs indexes in core '{}': {}".format(core, num_docs)) + else: + print("Core '%s' exists. Updating indexes..." % core) + # subprocess.call(["python3", "manage.py", "update_index"]) + # client.optimize_core(core) \ No newline at end of file diff --git a/sapl/base/search_indexes.py b/sapl/base/search_indexes.py index ed811cebb..3713833dd 100644 --- a/sapl/base/search_indexes.py +++ b/sapl/base/search_indexes.py @@ -36,20 +36,10 @@ class TextExtractField(CharField): self.model_attr = (self.model_attr, ) def solr_extraction(self, arquivo): - extracted_data = self._get_backend(None).extract_file_contents( - arquivo)['contents'] - # Remove as tags xml - extracted_data = re.sub('<[^>]*>', '', extracted_data) - # Remove tags \t e \n - extracted_data = extracted_data.replace( - '\n', ' ').replace('\t', ' ') - # Remove sinais de pontuação - extracted_data = re.sub('[' + string.punctuation + ']', - ' ', extracted_data) - # Remove espaços múltiplos - extracted_data = " ".join(extracted_data.split()) - - return extracted_data + return textract.process( + arquivo.path, + language='pt-br').decode('utf-8').replace('\n', ' ').replace( + '\t', ' ') def whoosh_extraction(self, arquivo): @@ -64,11 +54,11 @@ class TextExtractField(CharField): language='pt-br').decode('utf-8').replace('\n', ' ').replace( '\t', ' ') - def print_error(self, arquivo): - msg = 'Erro inesperado processando arquivo: %s' % ( - arquivo.path) - print(msg) - logger.error(msg) + def print_error(self, arquivo, error): + msg = 'Erro inesperado processando arquivo %s erro: %s' % ( + arquivo.path, error) + print(msg, error) + logger.error(msg, error) def file_extractor(self, arquivo): if not os.path.exists(arquivo.path) or \ @@ -79,20 +69,21 @@ class TextExtractField(CharField): if SOLR_URL: try: return self.solr_extraction(arquivo) - except Exception: - self.print_error(arquivo) + except Exception as err: + print(str(err)) + self.print_error(arquivo, err) # Em ambiente de DEV utiliza-se o Whoosh # Como ele não possui extração, faz-se uso do textract else: try: return self.whoosh_extraction(arquivo) - except ExtensionNotSupported as e: - print(str(e)) - logger.error(str(e)) - except Exception as e2: - print(str(e2)) - self.print_error(arquivo) + except ExtensionNotSupported as err: + print(str(err)) + logger.error(str(err)) + except Exception as err: + print(str(err)) + self.print_error(arquivo, str(err)) return '' def ta_extractor(self, value): @@ -154,6 +145,10 @@ class DocumentoAcessorioIndex(SearchIndex, Indexable): ) ) + def __init__(self, **kwargs): + super().__init__(**kwargs) + self.text.search_index = self + def get_model(self): return self.model diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 04ee8d0e0..fd7ddff67 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -216,7 +216,7 @@ class MateriaLegislativaForm(ModelForm): ano=ano).exists() if exist_materia or exist_doc: - raise ValidationError(_('Protocolo %s/%s ja possui' + raise ValidationError(_('Protocolo %s/%s já possui' ' documento vinculado' % (protocolo, ano))) diff --git a/sapl/settings.py b/sapl/settings.py index 7dad6da2b..92a9fbcfa 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -96,8 +96,8 @@ INSTALLED_APPS = ( # FTS = Full Text Search # Desabilita a indexação textual até encontramos uma solução para a issue # https://github.com/interlegis/sapl/issues/2055 -#HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' -HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.BaseSignalProcessor' +#HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.BaseSignalProcessor' # Disable auto index +HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' SEARCH_BACKEND = 'haystack.backends.whoosh_backend.WhooshEngine' SEARCH_URL = ('PATH', PROJECT_DIR.child('whoosh')) diff --git a/sapl/templates/materia/materialegislativa_filter.html b/sapl/templates/materia/materialegislativa_filter.html index b10c20346..762005bb5 100644 --- a/sapl/templates/materia/materialegislativa_filter.html +++ b/sapl/templates/materia/materialegislativa_filter.html @@ -4,10 +4,9 @@ {% block actions %}
- + {% if perms.materia.add_materialegislativa %} diff --git a/sapl/templates/norma/normajuridica_filter.html b/sapl/templates/norma/normajuridica_filter.html index 8119ce4d1..61e3e7bb2 100644 --- a/sapl/templates/norma/normajuridica_filter.html +++ b/sapl/templates/norma/normajuridica_filter.html @@ -4,11 +4,10 @@ {% block actions %}
- {% if perms.norma.add_normajuridica %} diff --git a/solr/sapl_configset/conf/lang/stopwords_en.txt b/solr/sapl_configset/conf/lang/stopwords_en.txt new file mode 100644 index 000000000..2c164c0b2 --- /dev/null +++ b/solr/sapl_configset/conf/lang/stopwords_en.txt @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# a couple of test stopwords to test that the words are really being +# configured from this file: +stopworda +stopwordb + +# Standard english stop words taken from Lucene's StopAnalyzer +a +an +and +are +as +at +be +but +by +for +if +in +into +is +it +no +not +of +on +or +such +that +the +their +then +there +these +they +this +to +was +will +with diff --git a/solr/sapl_configset/conf/lang/stopwords_pt.txt b/solr/sapl_configset/conf/lang/stopwords_pt.txt new file mode 100644 index 000000000..acfeb01af --- /dev/null +++ b/solr/sapl_configset/conf/lang/stopwords_pt.txt @@ -0,0 +1,253 @@ + | From svn.tartarus.org/snowball/trunk/website/algorithms/portuguese/stop.txt + | This file is distributed under the BSD License. + | See http://snowball.tartarus.org/license.php + | Also see http://www.opensource.org/licenses/bsd-license.html + | - Encoding was converted to UTF-8. + | - This notice was added. + | + | NOTE: To use this file with StopFilterFactory, you must specify format="snowball" + + | A Portuguese stop word list. Comments begin with vertical bar. Each stop + | word is at the start of a line. + + + | The following is a ranked list (commonest to rarest) of stopwords + | deriving from a large sample of text. + + | Extra words have been added at the end. + +de | of, from +a | the; to, at; her +o | the; him +que | who, that +e | and +do | de + o +da | de + a +em | in +um | a +para | for + | é from SER +com | with +não | not, no +uma | a +os | the; them +no | em + o +se | himself etc +na | em + a +por | for +mais | more +as | the; them +dos | de + os +como | as, like +mas | but + | foi from SER +ao | a + o +ele | he +das | de + as + | tem from TER +à | a + a +seu | his +sua | her +ou | or + | ser from SER +quando | when +muito | much + | há from HAV +nos | em + os; us +já | already, now + | está from EST +eu | I +também | also +só | only, just +pelo | per + o +pela | per + a +até | up to +isso | that +ela | he +entre | between + | era from SER +depois | after +sem | without +mesmo | same +aos | a + os + | ter from TER +seus | his +quem | whom +nas | em + as +me | me +esse | that +eles | they + | estão from EST +você | you + | tinha from TER + | foram from SER +essa | that +num | em + um +nem | nor +suas | her +meu | my +às | a + as +minha | my + | têm from TER +numa | em + uma +pelos | per + os +elas | they + | havia from HAV + | seja from SER +qual | which + | será from SER +nós | we + | tenho from TER +lhe | to him, her +deles | of them +essas | those +esses | those +pelas | per + as +este | this + | fosse from SER +dele | of him + + | other words. There are many contractions such as naquele = em+aquele, + | mo = me+o, but they are rare. + | Indefinite article plural forms are also rare. + +tu | thou +te | thee +vocês | you (plural) +vos | you +lhes | to them +meus | my +minhas +teu | thy +tua +teus +tuas +nosso | our +nossa +nossos +nossas + +dela | of her +delas | of them + +esta | this +estes | these +estas | these +aquele | that +aquela | that +aqueles | those +aquelas | those +isto | this +aquilo | that + + | forms of estar, to be (not including the infinitive): +estou +está +estamos +estão +estive +esteve +estivemos +estiveram +estava +estávamos +estavam +estivera +estivéramos +esteja +estejamos +estejam +estivesse +estivéssemos +estivessem +estiver +estivermos +estiverem + + | forms of haver, to have (not including the infinitive): +hei +há +havemos +hão +houve +houvemos +houveram +houvera +houvéramos +haja +hajamos +hajam +houvesse +houvéssemos +houvessem +houver +houvermos +houverem +houverei +houverá +houveremos +houverão +houveria +houveríamos +houveriam + + | forms of ser, to be (not including the infinitive): +sou +somos +são +era +éramos +eram +fui +foi +fomos +foram +fora +fôramos +seja +sejamos +sejam +fosse +fôssemos +fossem +for +formos +forem +serei +será +seremos +serão +seria +seríamos +seriam + + | forms of ter, to have (not including the infinitive): +tenho +tem +temos +tém +tinha +tínhamos +tinham +tive +teve +tivemos +tiveram +tivera +tivéramos +tenha +tenhamos +tenham +tivesse +tivéssemos +tivessem +tiver +tivermos +tiverem +terei +terá +teremos +terão +teria +teríamos +teriam diff --git a/solr/sapl_configset/conf/managed-schema b/solr/sapl_configset/conf/managed-schema new file mode 100644 index 000000000..0cba1950a --- /dev/null +++ b/solr/sapl_configset/conf/managed-schema @@ -0,0 +1,573 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/solr/sapl_configset/conf/params.json b/solr/sapl_configset/conf/params.json new file mode 100644 index 000000000..06114ef25 --- /dev/null +++ b/solr/sapl_configset/conf/params.json @@ -0,0 +1,20 @@ +{"params":{ + "query":{ + "defType":"edismax", + "q.alt":"*:*", + "rows":"10", + "fl":"*,score", + "":{"v":0} + }, + "facets":{ + "facet":"on", + "facet.mincount": "1", + "":{"v":0} + }, + "velocity":{ + "wt": "velocity", + "v.template":"browse", + "v.layout": "layout", + "":{"v":0} + } +}} \ No newline at end of file diff --git a/solr/sapl_configset/conf/protwords.txt b/solr/sapl_configset/conf/protwords.txt new file mode 100644 index 000000000..1dfc0abec --- /dev/null +++ b/solr/sapl_configset/conf/protwords.txt @@ -0,0 +1,21 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# Use a protected word file to protect against the stemmer reducing two +# unrelated words to the same base word. + +# Some non-words that normally won't be encountered, +# just to test that they won't be stemmed. +dontstems +zwhacky + diff --git a/solr/sapl_configset/conf/schema.xml b/solr/sapl_configset/conf/schema.xml new file mode 100644 index 000000000..597033929 --- /dev/null +++ b/solr/sapl_configset/conf/schema.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + text + + + + diff --git a/solr/sapl_configset/conf/solrconfig.xml b/solr/sapl_configset/conf/solrconfig.xml new file mode 100644 index 000000000..9a9f29196 --- /dev/null +++ b/solr/sapl_configset/conf/solrconfig.xml @@ -0,0 +1,1367 @@ + + + + + + + + + 7.3.1 + + + + + + + + + + + + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.lock.type:native} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.ulog.dir:} + ${solr.ulog.numVersionBuckets:65536} + + + + + 300000 + false + + + + + + 30000 + + + + + + + + + + + + + + 1024 + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + explicit + 10 + text + edismax + + + + + + + + + + + + + + + + explicit + json + true + + + + + + + + explicit + + + + + + _text_ + + + + + + + true + ignored_ + _text_ + + + + + + + + + text_general + + + + + + default + _text_ + solr.DirectSolrSpellChecker + + internal + + 0.5 + + 2 + + 1 + + 5 + + 4 + + 0.01 + + + + + + + + + + + + default + on + true + 10 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + + + + true + + + tvComponent + + + + + + + + + + + + true + false + + + terms + + + + + + + + string + + + + + + explicit + + + elevator + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + [^\w-\.] + _ + + + + + + + yyyy-MM-dd'T'HH:mm:ss.SSSZ + yyyy-MM-dd'T'HH:mm:ss,SSSZ + yyyy-MM-dd'T'HH:mm:ss.SSS + yyyy-MM-dd'T'HH:mm:ss,SSS + yyyy-MM-dd'T'HH:mm:ssZ + yyyy-MM-dd'T'HH:mm:ss + yyyy-MM-dd'T'HH:mmZ + yyyy-MM-dd'T'HH:mm + yyyy-MM-dd HH:mm:ss.SSSZ + yyyy-MM-dd HH:mm:ss,SSSZ + yyyy-MM-dd HH:mm:ss.SSS + yyyy-MM-dd HH:mm:ss,SSS + yyyy-MM-dd HH:mm:ssZ + yyyy-MM-dd HH:mm:ss + yyyy-MM-dd HH:mmZ + yyyy-MM-dd HH:mm + yyyy-MM-dd + + + + + java.lang.String + text_general + + *_str + 256 + + + true + + + java.lang.Boolean + booleans + + + java.util.Date + pdates + + + java.lang.Long + java.lang.Integer + plongs + + + java.lang.Number + pdoubles + + + + + + + + + + + + + + + + + + + + + + + + + + text/plain; charset=UTF-8 + + + + + ${velocity.template.base.dir:} + ${velocity.solr.resource.loader.enabled:true} + ${velocity.params.resource.loader.enabled:false} + + + + + 5 + + + + + + + + + + + + + + diff --git a/solr/sapl_configset/conf/stopwords.txt b/solr/sapl_configset/conf/stopwords.txt new file mode 100644 index 000000000..ae1e83eeb --- /dev/null +++ b/solr/sapl_configset/conf/stopwords.txt @@ -0,0 +1,14 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/solr/sapl_configset/conf/synonyms.txt b/solr/sapl_configset/conf/synonyms.txt new file mode 100644 index 000000000..eab4ee875 --- /dev/null +++ b/solr/sapl_configset/conf/synonyms.txt @@ -0,0 +1,29 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +#some test synonym mappings unlikely to appear in real input text +aaafoo => aaabar +bbbfoo => bbbfoo bbbbar +cccfoo => cccbar cccbaz +fooaaa,baraaa,bazaaa + +# Some synonym groups specific to this example +GB,gib,gigabyte,gigabytes +MB,mib,megabyte,megabytes +Television, Televisions, TV, TVs +#notice we use "gib" instead of "GiB" so any WordDelimiterGraphFilter coming +#after us won't split it into two words. + +# Synonym mappings can be used for spelling correction too +pixima => pixma + diff --git a/start.sh b/start.sh index 9695572ef..4d186d4cc 100755 --- a/start.sh +++ b/start.sh @@ -36,6 +36,8 @@ create_env() { echo "EMAIL_SEND_USER = ""${EMAIL_HOST_USER-''}" >> $FILENAME echo "DEFAULT_FROM_EMAIL = ""${EMAIL_HOST_USER-''}" >> $FILENAME echo "SERVER_EMAIL = ""${EMAIL_HOST_USER-''}" >> $FILENAME + echo "SOLR_URL = ""${SOLR_URL-'http://saplsolr:8983/solr/sapl'}" >> $FILENAME + echo "[ENV FILE] done." } @@ -46,11 +48,15 @@ create_env /bin/sh busy-wait.sh $DATABASE_URL +## SOLR +python3 docker_solr_init.py sapl saplsolr & + # manage.py migrate --noinput nao funcionava yes yes | python3 manage.py migrate #python3 manage.py collectstatic --no-input # python3 manage.py rebuild_index --noinput & + echo "Criando usuário admin..." user_created=$(python3 create_admin.py 2>&1)