[Xapian-tickets] [Xapian] #531: Python bindings attempt to use deprecated methods
Xapian
nobody at xapian.org
Sat Jan 29 07:34:20 GMT 2011
#531: Python bindings attempt to use deprecated methods
--------------------------------------+-------------------------------------
Reporter: rq | Owner: olly
Type: defect | Status: assigned
Priority: normal | Milestone:
Component: Xapian-bindings (Python) | Version:
Severity: normal | Keywords:
Blockedby: | Platform: All
Blocking: |
--------------------------------------+-------------------------------------
Changes (by olly):
* owner: richard => olly
* status: new => assigned
Comment:
The code in util.i which makes those calls is actually C++ code, and the
get methods aren't deprecated in the C++ API, so that part is OK.
I think there is an issue here though - this worked in 1.0 but doesn't in
1.2, and isn't listed as deprecated:
{{{
#!python
for item in mset:
print item[xapian.MSET_DID]
}}}
It wasn't actually documented as working in 1.0 though - the documented
use of MSET_DID, etc is:
{{{
#!python
for item in mset.items:
print item[xapian.MSET_DID]
}}}
(Note: mset.items not mset)
A better way to write this, which works in both 1.0 and 1.2 is:
{{{
#!python
for item in mset:
print item.docid
}}}
Looking into this has turned up another issue - we didn't had a feature
test for the MSET_* stuff. I've now added one, but it turns out
MSET_DOCUMENT doesn't work, as the element of the tuple it refers to is
never set!
My thoughts on how to address this mess:
* Since the way you are using MSET_* was never documented as working,
won't work
in 1.2.0 to 1.2.4, and has an easy replacement which is a nicer API and
works
in both Xapian 1.0 and 1.2, I think it probably doesn't make sense to
make it
work again in 1.2.5 onwards. We should just list it in the deprecation
document
along with what to replace it with. This isn't ideal, but seems to be
the best
of the available options to me.
* MSET_DOCUMENT has never worked it seems, so it doesn't make much sense
to try
to fix it now - we should just document that it has never worked.
* The properties interface is nicer than the tuple one - I think we
should just
deprecate MSET_* (and eventually remove it at some future point).
--
Ticket URL: <http://trac.xapian.org/ticket/531#comment:1>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list