Opened 14 years ago

Closed 9 years ago

Last modified 9 years ago

#499 closed defect (fixed)

ValuePostingSource value_it not exported to Python (and other?) bindings

Reported by: Joost Cassee Owned by: Richard Boulton
Priority: normal Milestone: 1.3.5
Component: Xapian-bindings Version: 1.2.2
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

ValuePostingSource keeps its value stream iterator in the protected value_it property. This property is needed to generate weight and should be exported to the Python bindings.

The problem probably applies to other language bindings as well.

Change History (7)

comment:1 by Olly Betts, 14 years ago

Milestone: 1.2.x
Owner: changed from Olly Betts to Richard Boulton

This should be fixable in 1.2.x (unless it's just not possible, but I think it should be), so setting milestone appropriately.

Also passing over to Richard, at least for the Python part.

comment:2 by Olly Betts, 13 years ago

Milestone: 1.2.x1.3.0

I think perhaps the best solution here would be to add getters for each of the protected members, possibly only for the bindings (by using %extend).

Fixing that in 1.3.x first makes more sense at this point, though if done just for the bindings it would be an API addition, and so probably OK to backport. If we did it for C++, we'd have to leave the protected variables in place (for ABI compatibility in 1.2.x, and probably deprecated but still present for backward compatibility for 1.3.x/1.4.x).

comment:3 by Olly Betts, 13 years ago

Milestone: 1.3.01.3.x

comment:4 by Olly Betts, 9 years ago

Milestone: 1.3.x1.3.5

As far as I can see, %extend doesn't work for allowing access to a protected member.

So as with #498, either we create a subclass in the bindings which adds C++ getters/setters and wrap that instead, or else we just add these in C++. Consistency in handling these (and anything similar) would be better.

comment:5 by Olly Betts, 9 years ago

After too much trying I found my dumb typo and seem to have this working now. Will clean up and commit shortly.

comment:6 by Olly Betts, 9 years ago

Resolution: fixed
Status: newclosed

Fixed in [cc748c2f02f7631b960f432e5b10127a9d7319eb].

I've added the C++ getter/setter wrappers to the 1.2 branch for 1.2.23 to make it easier for people to update their C++ code for this change, but due to set_maxweight() being protected in 1.2.x (which was #498) you'll need 1.3.x for fully subclassable PostingSource in Python.

comment:7 by Olly Betts, 9 years ago

[37562fae405e4bc34d0cf3350775dcf91dd6283a] is a follow up fix, adjusting the API and fixing a testcase failure caused by the first commit.

Note: See TracTickets for help on using tickets.