← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-dspc-fti into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-dspc-fti into launchpad:master.

Commit message:
Remove DistroSeriesPackageCache.fti from model

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395693

The underlying database column still exists, but we only access it via fti_search which doesn't require it to be modelled.  Having it in the model posed a Python 3 porting problem, because it isn't necessarily valid UTF-8 but the database returns it as a text string when queried.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-dspc-fti into launchpad:master.
diff --git a/lib/lp/soyuz/doc/package-cache.txt b/lib/lp/soyuz/doc/package-cache.txt
index 2da0376..61b7260 100644
--- a/lib/lp/soyuz/doc/package-cache.txt
+++ b/lib/lp/soyuz/doc/package-cache.txt
@@ -18,8 +18,6 @@ DistributionSourcePackageCache table, including:
    generated by this source.
  * binpkgdescription, text containing all descriptions of the binaries
    generated by this source.
- * fti, a tsvector generated on insert or update with the text indexes
-   for name, binpkgnames, binpkgsummaries and binpkgdescriptions.
 
     >>> from lp.registry.interfaces.distribution import IDistributionSet
     >>> from lp.soyuz.model.distributionsourcepackagecache import (
@@ -56,8 +54,6 @@ table, including:
  * description, binary description in text format.
  * summaries, binary summaries  in text format
  * descriptions, binary description in text format.
- * fti, a tsvector generated on insert or update with the text indexes
-   for name, summary, description, summaries and descriptions.
 
     >>> from lp.soyuz.model.distroseriespackagecache import (
     ...              DistroSeriesPackageCache)
@@ -685,29 +681,6 @@ cache entry for a PPA package with the same name.
     True
 
 
-Content class declarations for FTI
-==================================
-
-For the FTI to work properly with Storm queries, the fti column on the
-content class must be declared as Bytes, otherwise unicode errors are likely
-to be thrown.
-
-    >>> transaction.commit()
-    >>> binary_name = getUtility(
-    ...      IBinaryPackageNameSet).queryByName('commercialpackage')
-    >>> cache_with_unicode = DistroSeriesPackageCache(
-    ...      archive=ubuntu.main_archive, distroseries=warty,
-    ...      binarypackagename=binary_name, summaries=u"“unicode“")
-    >>> transaction.commit()
-
-    >>> cache = DistroSeriesPackageCache.get(id=cache_with_unicode.id)
-
-The following line fails unless the content class FTI column is Bytes:
-
-    >>> cache.fti
-    "'\xc3\xa2\xc2\x80\xc2\x9cunicode\xc3\xa2\xc2\x80\xc2\x9c':1B"
-
-
 Disabled archives caches
 ========================
 
diff --git a/lib/lp/soyuz/model/distroseriespackagecache.py b/lib/lp/soyuz/model/distroseriespackagecache.py
index 9bccd11..19e3fbf 100644
--- a/lib/lp/soyuz/model/distroseriespackagecache.py
+++ b/lib/lp/soyuz/model/distroseriespackagecache.py
@@ -18,7 +18,6 @@ from storm.expr import (
     Max,
     Select,
     )
-from storm.locals import Bytes
 from zope.interface import implementer
 
 from lp.services.database import bulk
@@ -45,7 +44,6 @@ class DistroSeriesPackageCache(SQLBase):
     binarypackagename = ForeignKey(dbName='binarypackagename',
         foreignKey='BinaryPackageName', notNull=True)
 
-    fti = Bytes(allow_none=True, default=None)
     name = StringCol(notNull=False, default=None)
     summary = StringCol(notNull=False, default=None)
     description = StringCol(notNull=False, default=None)