1
0
mirror of https://github.com/djohnlewis/stackdump synced 2024-12-04 23:17:37 +00:00

Changed the indexed field from site name to site key because site key is relatively more unique.

This commit is contained in:
Samuel Lai 2012-02-05 17:52:44 +11:00
parent 3e02dcf151
commit 6d32f93452
2 changed files with 6 additions and 6 deletions

View File

@ -498,7 +498,7 @@
<!-- fields are listed here so searches can be performed against them -->
<!-- the ID field needs to be a string for the QueryElevationComponent -->
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="siteName" type="string" indexed="true" stored="true" required="true" />
<field name="siteKey" type="string" indexed="true" stored="true" required="true" />
<field name="creationDate" type="tdate" indexed="true" stored="false" required="true"/>
<!-- the field name in XML is score, but that's a reserved lucene keyword -->
<field name="votes" type="tint" indexed="true" stored="false" required="true"/>

View File

@ -389,7 +389,7 @@ class PostContentHandler(xml.sax.ContentHandler):
# map other fields to search index doc
doc['id'] = str(q['id'])
doc['siteName'] = self.site.name
doc['siteKey'] = self.site.key
doc['creationDate'] = q['creationDate']
# the XML field name is score, but score is a reserved lucene keyword
doc['votes'] = q['score']
@ -564,10 +564,10 @@ for site in sites:
sys.stdout.flush()
Site.delete(site.id) # the relationship cascades, so other rows will be deleted
print('Deleted.\n')
print('Deleting site "%s" from the solr... ' % site_name)
solr.delete(q='siteName:"%s"' % site_name)
print('Deleted.\n')
print('Deleting site "%s" from the solr... ' % site.name)
solr.delete(q='siteKey:"%s"' % site.key)
print('Deleted.\n')
# create a new Site
site = Site(name=site_name, desc=site_desc, key=site_key, dump_date=dump_date, import_date=datetime.now())