from django.db import models
from django.db.models import Index


class CutWord(models.Model):
    """
    分词表 - 存储所有分词结果
    """
    title = models.CharField(
        max_length=50, 
        verbose_name='分词内容',
        db_index=True,  # 为分词字段创建索引以提高查询性能
        unique=True     # 确保分词唯一性
    )
    created_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    updated_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        verbose_name = '分词'
        verbose_name_plural = '分词'

    def __str__(self):
        return self.title