class VendorSearch(models.Model): """Model pointing to the original searched model.""" link = models.OneToOneField('market.Vendor', on_delete=models.CASCADE) name = models.CharField(max_length=100) motto = models.CharField(max_length=255) description = models.TextField(null=True) fts_name = TSVectorField(('name', ), dictionary=settings.PG_FT_LANGUAGE) fts = TSVectorField((('name', 'A'), ('motto', 'B'), ('description', 'C')), dictionary=settings.PG_FT_LANGUAGE) class Meta: """Define mandatory app_label.""" app_label = 'search' required_db_vendor = 'postgresql' required_db_features = ['tsearch2']
class Article(models.Model): title = models.CharField(max_length=255) article = models.TextField() fts_index = TSVectorField((('title', 'A'), 'article'), dictionary='portuguese') def __str__(self): return self.title
class TSQueryModel(models.Model): title = models.CharField(max_length=50) body = models.TextField() sometext = models.CharField(max_length=50, null=True, blank=True) tsvector = TSVectorField(('title', 'body')) def __str__(self): return self.title
class TSMultidicModel(models.Model): title = models.CharField(max_length=50) body = models.TextField() sometext = models.CharField(max_length=50, null=True, blank=True) dictionary = models.CharField( max_length=15, choices=(('english', 'english'), ('portuguese', 'portuguese')), default='english' ) tsvector = TSVectorField((('title', 'A'), 'body'), dictionary='dictionary') def __str__(self): return self.title
class LocalityIndex(models.Model): """ LocalityIndex enables FullTextSearch filtering for the *Locality* based on its *Values* and *fts_rank* specified by a *Specification* LocalityIndex will be autoupdated when 'SIG_locality_values_updated' is triggered """ locality = models.OneToOneField('Locality') ranka = models.TextField(null=True) rankb = models.TextField(null=True) rankc = models.TextField(null=True) rankd = models.TextField(null=True) fts_index = TSVectorField( (('ranka', 'A'), ('rankb', 'B'), ('rankc', 'C'), ('rankd', 'D')))
class Rate(models.Model): determination = models.ForeignKey(WageDetermination) dollars_per_hour = models.DecimalField(max_digits=6, decimal_places=2) fringe = models.TextField() group_qualifier = models.TextField(blank=True) construction_type = models.TextField() construction_subtype = models.TextField(blank=True) construction_qualifier = models.TextField(blank=True) construction_survey_qualifier = models.TextField(blank=True) occupation = models.TextField() occupation_qualifier = models.TextField(blank=True) rate_name = models.TextField(blank=True) rate_name_qualifier = models.TextField(blank=True) subrate_name = models.TextField(blank=True) subrate_name_qualifier = models.TextField(blank=True) counties = models.ManyToManyField(County) location_qualifier = models.TextField(blank=True) survey_location_qualifier = models.TextField(blank=True) # when a user needs to request a new determination # official_dol = models.BooleanField(default=True) _STR_TEMPLATE = '{determination}: {occupation}/{rate_name}/{subrate_name} ' _STR_TEMPLATE += '${dollars_per_hour}' def __str__(self): return self._STR_TEMPLATE.format(determination=self.determination, **self.__dict__) fts_index = TSVectorField(( ('occupation', 'A'), ('rate_name', 'B'), ('subrate_name', 'B'), 'occupation_qualifier', 'rate_name_qualifier', 'subrate_name_qualifier', ), dictionary='english')
class TSVectorModelError(models.Model): title = models.CharField(max_length=50) body = models.TextField() tsvector = TSVectorField( (('x', 'z'), 'body'))
class TSVectorModelClean(models.Model): title = models.CharField(max_length=50) body = models.TextField() tsvector = TSVectorField( (('title', 'A'), 'body'))