Skip to content

Commit

Permalink
remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Jul 29, 2024
1 parent 5918e1e commit db2b125
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Changelog
1.4.1 (unreleased)
------------------

- Nothing changed yet.

- Raise custom exception when there is an error.
[cekk]

1.4.0 (2024-05-05)
------------------
Expand Down
4 changes: 1 addition & 3 deletions src/rer/solrpush/browser/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def sync_contents(
tot = len(brains_to_sync)
for brain in brains_to_sync:
i += 1
if i % 10 == 0:
if i % 100 == 0:
logger.info(f"Progress: {i}/{tot}")
if not disable_progress:
status["counter"] = status["counter"] + 1
Expand All @@ -327,9 +327,7 @@ def sync_contents(
if brain.UID not in solr_items:
# missing from solr: try to index it
try:
logger.info("send to solr")
res = push_to_solr(item)
logger.info("received response from solr")
if res:
indexed.append(brain.getPath())
except SolrError as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from rer.solrpush.restapi.services.solr_search.batch import SolrHypermediaBatch
from rer.solrpush.utils import search as solr_search


DEFAULT_METADATA_FIELDS = set(
["@id", "@type", "description", "review_state", "title"]
)
Expand Down
24 changes: 14 additions & 10 deletions src/rer/solrpush/utils/solr_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
TRIM = re.compile(r"\s+")
ESCAPE_CHARS_RE = re.compile(r'(?<!\\)(?P<char>[&|+\-!(){}[\]^"~*?:])')


class SOLRException(Exception):
"Raised when the solr respoonse return an error"
pass


# HELPER METHODS


Expand Down Expand Up @@ -304,13 +310,12 @@ def search(
if is_solr_active():
# log it beacuse it's misconfigured
logger.error(msg)
return {
"error": True,
"message": translate(
raise SOLRException(
translate(
_("solr_configuration_error_label", default=msg),
context=api.portal.get().REQUEST,
),
}
)
)
solr_query = generate_query(
query,
fl=fl,
Expand All @@ -323,18 +328,17 @@ def search(
return res
except Exception as e:
logger.exception(e)
return {
"error": True,
"message": translate(
raise SOLRException(
translate(
_(
"search_error_label",
default="Unable to perform a search with SOLR."
" Please contact the site administrator or wait some"
" minutes.",
),
context=api.portal.get().REQUEST,
),
}
)
)


def _set_query_debug(solr, params):
Expand Down

0 comments on commit db2b125

Please sign in to comment.