Re: StoreField with long value using python3

2021-04-20 Thread Andi Vajda



On Tue, 20 Apr 2021, antony wrote:



Hello,

Anyone help me how to use StoredField(String name, long value). Its not
working because there is no 'long integer' in Python 3.


Not sure that's the problem.
It looks like the StoredField(int) overload is called before the 
StoredField(long). This is a bug.


A possible workaround would be to edit the StoredField class to add a 
constructor accepting a java.lang.Long() and then passing it a Long(cdate) ?

especially since all it does is set Object fieldsData on Field anyway...

I didn't try this out...

Andi..



I am using Python 3.8.0 and pylucene 8.6.1.

Source code:

cdate = int(datetime.datetime.now().strftime("%Y%m%d%H%M"))

print(1, cdate)

doc = Document()
doc.add(LongPoint('cdatetime', cdate))
doc.add(StoredField('cdatetime', cdate))

print(2, doc)

writer.addDocument(doc)
writer.commit()
writer.close()

Output:

1, cdate = 202104202312

2, Document
*stored*>


Thanks,
Antony



--
Sent from: http://pylucene-users-developers-list.2474766.n2.nabble.com/



StoreField with long value using python3

2021-04-20 Thread antony


Hello,

Anyone help me how to use StoredField(String name, long value). Its not
working because there is no 'long integer' in Python 3.

I am using Python 3.8.0 and pylucene 8.6.1. 

Source code:

cdate = int(datetime.datetime.now().strftime("%Y%m%d%H%M"))

print(1, cdate)

doc = Document()
doc.add(LongPoint('cdatetime', cdate))
doc.add(StoredField('cdatetime', cdate))

print(2, doc)

writer.addDocument(doc)
writer.commit()
writer.close()

Output:

1, cdate = 202104202312

2, Document
*stored*>


Thanks,
Antony



--
Sent from: http://pylucene-users-developers-list.2474766.n2.nabble.com/