Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
webservices
cern-search
cern-search-rest-api
Commits
17455aeb
Commit
17455aeb
authored
Apr 05, 2018
by
Pablo Panero
Browse files
Renamed module from records to cernsearch
parent
d27363fc
Changes
11
Hide whitespace changes
Inline
Side-by-side
cern_search_rest/modules/
records
/__init__.py
→
cern_search_rest/modules/
cernsearch
/__init__.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/api.py
→
cern_search_rest/modules/
cernsearch
/api.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/fetchers.py
→
cern_search_rest/modules/
cernsearch
/fetchers.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/jsonschemas/__init__.py
→
cern_search_rest/modules/
cernsearch
/jsonschemas/__init__.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/jsonschemas/doc
-
v0.0.1.json
→
cern_search_rest/modules/
cernsearch
/jsonschemas/
test-
doc
_
v0.0.1.json
View file @
17455aeb
{
"title"
:
"Custom record schema v0.0.1"
,
"id"
:
"http://localhost:5000/schemas/doc
-
v0.0.1.json"
,
"id"
:
"http://localhost:5000/schemas/
cern_search_test-
doc
_
v0.0.1.json"
,
"$schema"
:
"http://json-schema.org/draft-04/schema#"
,
"type"
:
"object"
,
"properties"
:
{
...
...
cern_search_rest/modules/
records
/mappings/__init__.py
→
cern_search_rest/modules/
cernsearch
/mappings/__init__.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/mappings/v5/__init__.py
→
cern_search_rest/modules/
cernsearch
/mappings/v5/__init__.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/mappings/v5/
records/
doc
-
v0.0.1.json
→
cern_search_rest/modules/
cernsearch
/mappings/v5/
cernsearch/test-
doc
_
v0.0.1.json
View file @
17455aeb
...
...
@@ -4,7 +4,7 @@
"index.mapping.total_fields.limit"
:
3000
},
"mappings"
:
{
"doc
-
v0.0.1"
:
{
"
test-
doc
_
v0.0.1"
:
{
"numeric_detection"
:
true
,
"_all"
:
{
"analyzer"
:
"english"
...
...
cern_search_rest/modules/
records
/permissions.py
→
cern_search_rest/modules/
cernsearch
/permissions.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/providers.py
→
cern_search_rest/modules/
cernsearch
/providers.py
View file @
17455aeb
File moved
cern_search_rest/modules/
records
/utils.py
→
cern_search_rest/modules/
cernsearch
/utils.py
View file @
17455aeb
...
...
@@ -8,7 +8,7 @@ from flask import current_app
from
invenio_search
import
current_search
from
invenio_search.utils
import
schema_to_index
INDEX_PREFIX
=
current_app
.
config
[
'CERN_SEARCH_DEFAULT_INDEX_PREFIX'
]
def
get_user_provides
():
...
...
@@ -16,7 +16,7 @@ def get_user_provides():
return
[
need
.
value
for
need
in
g
.
identity
.
provides
]
def
default
_record_to_index
(
record
):
def
cern_search
_record_to_index
(
record
):
"""Get index/doc_type given a record.
It tries to extract from `record['$schema']` the index and doc_type,
the index has `CERN_SEARCH_INDEX_PREFIX` as prefix or `CERN_SEARCH_DEFAULT_INDEX_PREFIX`
...
...
@@ -25,6 +25,8 @@ def default_record_to_index(record):
:param record: The record object.
:returns: Tuple (index, doc_type).
"""
INDEX_PREFIX
=
current_app
.
config
[
'CERN_SEARCH_DEFAULT_INDEX_PREFIX'
]
index_names
=
current_search
.
mappings
.
keys
()
schema
=
record
.
get
(
'$schema'
,
''
)
if
isinstance
(
schema
,
dict
):
...
...
@@ -36,7 +38,7 @@ def default_record_to_index(record):
index
,
doc_type
=
schema_to_index
(
schema
,
index_names
=
index_names
)
if
index
and
doc_type
:
return
'{0}{1}'
.
format
(
INDEX_PREFIX
,
index
),
doc_type
return
'{0}{1}'
.
format
(
INDEX_PREFIX
,
index
),
doc_type
else
:
return
(
'{0}{1}'
.
format
(
current_app
.
config
[
'CERN_SEARCH_DEFAULT_INDEX_PREFIX'
],
current_app
.
config
[
'INDEXER_DEFAULT_INDEX'
]),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment