Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion c2corg_api/scripts/es/fill_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ def progress(count, total_count):
count = 0
with batch:
for doc_type in document_types:
print('Importing document type {}'.format(doc_type))
if doc_type not in search_documents:
# some document types (e.g. coverages) are not indexed
logging.warning(
'Document type {} is not indexed'.format(doc_type))
continue

logging.info('Importing document type {}'.format(doc_type))
to_search_document = search_documents[doc_type].to_search_document

for doc in sync.get_documents(session, doc_type, batch_size,
Expand Down
5 changes: 5 additions & 0 deletions c2corg_api/scripts/es/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ def sync_documents(session, changed_documents, batch_size):
docs_per_type = get_documents_per_type(changed_documents)
add_dependent_documents(session, docs_per_type)
for doc_type, document_ids in docs_per_type.items():
if doc_type not in search_documents:
# some document types (e.g. coverages) are not indexed
logging.warning(
'Document type {} is not indexed'.format(doc_type))
continue
if document_ids:
docs = get_documents(
session, doc_type, batch_size, document_ids)
Expand Down
6 changes: 2 additions & 4 deletions c2corg_api/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
from c2corg_api.views.validation import validate_pagination, \
validate_preferred_lang_param
from c2corg_api.views.waypoint import waypoint_documents_config
from c2corg_api.security.acl import ACLDefault
from cornice.resource import resource, view


@resource(path='/search', cors_policy=cors_policy)
class SearchRest(object):
def __init__(self, request):
self.request = request

class SearchRest(ACLDefault):
@view(validators=[validate_pagination, validate_preferred_lang_param])
def get(self):
"""Search for a query word (simple search).
Expand Down
Loading