Good day to you,
I have the following issue when setting the value of a field, value containing
a character > 160 (Pylucene 8.1.1, Python 3.7.2)
...
(Pdb) field
<Field: stored,indexed,tokenized,omitNorms
indexOptions=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS<text:>>
(Pdb) value = '«Volgende facturen werden verstuurd aan de financiële dienst.»'
(Pdb) type(value)
<class 'str'>
(Pdb) field.setStringValue(value)
(Pdb) field
<Field:
stored,indexed,tokenized,omitNorms,indexOptions=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS<text:«Volgende
facturen werden verstuurd aan de financiële dienst>>
The field value has lost 2 characters.
But when I encode value:
(Pdb) value = value.encode('utf-8')
(Pdb) value
b'\xc2\xabVolgende facturen werden verstuurd aan de financi\xc3\xable
dienst.\xc2\xbb'
(Pdb) field.setStringValue(value)
(Pdb) field
<Field:
stored,indexed,tokenized,omitNorms,indexOptions=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS<text:«Volgende
facturen werden verstuurd aan de financiële dienst.»>>
The field value is correct.
So what does field.setStringValue expect: a string (as says the Lucene
documentation) or a byte sequence?
Thank you very much.
Met vriendelijke groeten,
Marc Jeurissen
Bibliotheek UAntwerpen
Stadscampus – Ve35.303
Venusstraat 35 – 2000 Antwerpen
[email protected]
T +32 3 265 49 71