Dear Kenji,
Apologies for the late reply. I was away for a few days.
Do you use virtual fields for computing the article_eq and ltitle?
>
>
No.
Here is my model:
akb_signature_uuid = db.Table(db, 'akb_signature_uuid',
Field('uuid', length = 64, default =
lambda:str(uuid.uuid4()),
notnull = True, writable = False, readable =
False,
unique = True, ondelete = 'CASCADE'),
Field('created_on', 'datetime', default = request.now,
readable = False, writable = False),
Field('created_by', db.auth_user, default =
auth.user_id,
readable = False, writable = False),
Field('updated_on', 'datetime', default = request.now,
readable = False, writable = False),
Field('updated_by', db.auth_user, update =
auth.user_id,
readable = False, writable = False)
## The following two functions are used to calculate article_eq:
def au_cleanup(au):
au1 = re.sub(',', '', au.strip())
au2 = re.sub('[ ]+', ' ', au1)
return au2.upper()
def art_ekw(art):
skrywers = set ([])
if art.primaryauthor:
skrywers.add (au_cleanup(art.primaryauthor))
if art.authors:
for au in art.authors.split(';'):
skrywers.add(au_cleanup(au))
if len(skrywers):
ekw = 1.0 / len(skrywers)
else:
ekw = 0
return ekw
db.define_table('akb_articles',
Field('title'),
Field('primaryauthor'),
Field('authors', 'text'),
Field('rp_author', length = 64,
requires = IS_EMPTY_OR(IS_IN_DB(db,
'akb_reprint.uuid', '%(rp_author)s'))),
Field('journal',
requires = IS_IN_DB(db, 'akb_journal.uuid',
'%(title)s')),
Field('bib_id'),
Field('bib_pages'),
Field('doctype'),
Field('language'),
Field('abstract', 'text'),
Field('bib_vol'),
Field('bib_date'),
Field('url'),
Field('pubyear', compute = lambda x: x['bib_date'][-4:]),
Field('ut', # isi-unieke rekordnommer
requires = IS_EMPTY_OR(IS_NOT_IN_DB(db,
'akb_articles.ut'))),
Field('scopus_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db,
'akb_articles.scopus_id'))),
Field('sabinet_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db,
'akb_articles.sabinet_id'))),
Field('isap_id', requires = IS_EMPTY_OR(IS_NOT_IN_DB(db,
'akb_articles.isap_id'))),
Field('ltitle', compute = lambda x:
re.sub('<[iI]>|<[/][iI]>|<[sS][uU][pbBP]>|</[sS][uU][pPbB]>|\W',
'',
x['title'].lower())),
Field('article_eq', 'double' , compute = lambda x:
art_ekw(x)),
akb_signature_uuid,
format = '%(title)s'
)
If it didn't work, please let me know more details.
>
As I am not using virtualfields, I did not try your suggestion.
Thanks for your attention.
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)