Bug 82651 - Store contents for snippet retrieval in MySQL
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1399 6955db30-a419-402b-8a0d-67ecbb4d7f56remotes/github/custis
parent
80ccb26b20
commit
a564b02d18
|
@ -634,7 +634,7 @@ enabled = 0
|
|||
# Set to 1 to enable indexing of file contents using Sphinx and Tika
|
||||
index_content = 0
|
||||
|
||||
# Set to limit stored text file content size (4 MB default, 0 = unlimited)
|
||||
# Set to limit stored text file content size (4 MB default, 0 = unlimited, -1 = don't store content, index only)
|
||||
#content_max_size = 4194304
|
||||
|
||||
# Database hostname, port, and socket
|
||||
|
|
|
@ -392,10 +392,11 @@ class CheckinDatabase:
|
|||
)
|
||||
# Sphinx (at least 2.0.1) still caches all string attributes inside RAM,
|
||||
# so we'll store them in MySQL (used only for snippet display)
|
||||
# Limit content size:
|
||||
if self.content_max_size and len(content) >= self.content_max_size:
|
||||
content = content[0:self.content_max_size]
|
||||
cursor.execute('INSERT INTO contents SET id=%s, content=%s', (commit_id, content))
|
||||
if self.content_max_size >= 0:
|
||||
# Limit content size:
|
||||
if self.content_max_size != 0 and len(content) >= self.content_max_size:
|
||||
content = content[0:self.content_max_size]
|
||||
cursor.execute('INSERT INTO contents SET id=%s, content=%s', (commit_id, content))
|
||||
except Exception, e:
|
||||
print ("Error adding commit: '"+str(e)+"'\nValues were:\n"+
|
||||
"\n".join(i+'='+str(props[i]) for i in props))
|
||||
|
|
Loading…
Reference in New Issue