Skip to content

Commit

Permalink
[3027] add no solr commit flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Dec 4, 2012
1 parent 783cf82 commit e5407f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckan/lib/search/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import re

from pylons import config
from paste.deploy.converters import asbool

from common import SearchIndexError, make_connection
from ckan.model import PackageRelationship
Expand Down Expand Up @@ -223,6 +224,8 @@ def index_package(self, pkg_dict, defer_commit=False):
try:
conn = make_connection()
commit = not defer_commit
if asbool(config.get('ckan.no_solr_commit', 'false')):
commit = False
conn.add_many([pkg_dict], _commit=commit)
except Exception, e:
log.exception(e)
Expand Down Expand Up @@ -251,7 +254,8 @@ def delete_package(self, pkg_dict):
config.get('ckan.site_id'))
try:
conn.delete_query(query)
conn.commit()
if not asbool(config.get('ckan.no_solr_commit', 'false')):
conn.commit()
except Exception, e:
log.exception(e)
raise SearchIndexError(e)
Expand Down

0 comments on commit e5407f4

Please sign in to comment.