Implement index assignments #22
|
@ -87,7 +87,7 @@ def update(db: DbContext, lexicon_id: int, indices: Sequence[ArticleIndex]) -> N
|
|||
"""
|
||||
Update the indices for a lexicon. Indices are matched by type and pattern.
|
||||
An extant index not matched to an input is deleted, and an input index not
|
||||
matched to a an extant index is created. Matched indexes are updated with
|
||||
matched to a an extant index is created. Matched indices are updated with
|
||||
the input logical and display orders and capacity.
|
||||
"""
|
||||
extant_indices: Sequence[ArticleIndex] = list(get_for_lexicon(db, lexicon_id))
|
||||
|
|
|
@ -8,7 +8,7 @@ from .helpers import add_argument
|
|||
|
||||
|
||||
COMMAND_NAME = "index"
|
||||
COMMAND_HELP = "Interact with indexes."
|
||||
COMMAND_HELP = "Interact with indices."
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ class Lexicon(ModelBase):
|
|||
memberships = relationship("Membership", back_populates="lexicon")
|
||||
characters = relationship("Character", back_populates="lexicon")
|
||||
articles = relationship("Article", back_populates="lexicon")
|
||||
indexes = relationship("ArticleIndex", back_populates="lexicon")
|
||||
indices = relationship("ArticleIndex", back_populates="lexicon")
|
||||
index_rules = relationship("ArticleIndexRule", back_populates="lexicon")
|
||||
content_rules = relationship("ArticleContentRule", back_populates="lexicon")
|
||||
posts = relationship("Post", back_populates="lexicon")
|
||||
|
@ -502,7 +502,7 @@ class ArticleIndex(ModelBase):
|
|||
# Foreign key relationships #
|
||||
#############################
|
||||
|
||||
lexicon = relationship("Lexicon", back_populates="indexes")
|
||||
lexicon = relationship("Lexicon", back_populates="indices")
|
||||
index_rules = relationship("ArticleIndexRule", back_populates="index")
|
||||
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ def sort_by_index_spec(articles, index_specs, key=None):
|
|||
indexed = OrderedDict()
|
||||
for index in index_list_order:
|
||||
indexed[index.pattern] = []
|
||||
# Sort articles into indexes
|
||||
# Sort articles into indices
|
||||
for article in articles_titlesorted:
|
||||
for index in index_eval_order:
|
||||
if index_match(index, key(article)):
|
||||
|
|
|
@ -159,7 +159,7 @@ def index_post(lexicon_name):
|
|||
# Initialize the form
|
||||
form = IndexSchemaForm()
|
||||
if form.validate():
|
||||
# Valid data, strip out all indexes with the blank type
|
||||
# Valid data, strip out all indices with the blank type
|
||||
indices = [
|
||||
index_def.to_model()
|
||||
for index_def in form.indices.entries
|
||||
|
|
Loading…
Reference in New Issue