Hi, I've just noticed that set_max_wildcard_expansion() has been removed in favour of set_max_expansion() in Xapian. Has the new method been added to the Perl-bindings? We have some old Perl code that uses set_max_wildcard_expansion(), and I have a test of too large expansion that now returns "something terrible happened" instead of"Exception: Wildcard ... expands too much (exceeding N)", so I'm looking to migrate. We are moving from Ubuntu 16.04 (libxapian 1.2.22, Search::Xapian 1.2.21) to Ubuntu 18.04 (libxapian 1.4.5, Search::Xapian 1.2.25). Best regards, Adam -- "This computer stuff is amazingly complicated. I Adam Sj?gren don't know how anyone gets anything done." asjo at koldfront.dk
On Mon, Nov 16, 2020 at 05:31:17PM +0100, Adam Sj?gren wrote:> I've just noticed that set_max_wildcard_expansion() has been removed in > favour of set_max_expansion() in Xapian.Yes, though it's only actually been removed from git master.> Has the new method been added to the Perl-bindings?It's not wrapped for the older hand-coded Search::Xapian. I've not been actively updating that for such API changes because it's quite a lot of manual work, though I'm happy to take clean patches. The newer SWIG-based bindings wrap it, and as of 1.4.16 they're no longer "experimental". They aim to be compatible with Search::Xapian to a large degree, but a few things aren't - there's a list of these (or at least those we know about) in the POD docs. Probably the most likely to affect people is that we no longer overload stringification and integer conversion. For stringification this is forced on us by a current limitation of SWIG, but in hindsight overloading these to call entirely different methods for different classes is quite confusing.> We have some old Perl code that uses set_max_wildcard_expansion(), and I > have a test of too large expansion that now returns "something terrible > happened" instead of"Exception: Wildcard ... expands too much (exceeding > N)", so I'm looking to migrate.I had a quick look and I think this is because Search::Xapian is still maintained on the 1.2 branch, and uses a list of the C++ exceptions from xapian-core 1.2.x. This exception is thrown as WildcardError, which was added since 1.2.x, so it isn't identified specifically and the fallback message "something terrible happened" is used instead. So I think we could just copy over the latest list of exceptions to address that. But for a short term workaround your testcase can probably just accept the "something terrible happened" as meaning the exception was triggered. Cheers, Olly
Adam writes:> I've just noticed that set_max_wildcard_expansion() has been removed in > favour of set_max_expansion() in Xapian. > > Has the new method been added to the Perl-bindings?Oh, it's there, but only for Xapian 1.5.0+:? void QueryParser::set_max_wildcard_expansion(termcount limit) CODE: #if XAPIAN_AT_LEAST(1,5,0) THIS->set_max_expansion(limit, Xapian::Query::WILDCARD_LIMIT_ERROR, Xapian::QueryParser::FLAG_WILDCARD); #else THIS->set_max_wildcard_expansion(limit); #endif - QueryParser.xs Hm, why doesn't it then work for me on Ubuntu 18.04 libxapian 1.4.5, Search::Xapian 1.2.25. Ah, perhaps it was added between 1.2.25.0 (in Ubuntu 18.04) and 1.2.25.2 (latest). I could only find a tarball of the latest Search::Xapian, but no repository? Best regards, Adam -- "I can do without honey, for a while Adam Sj?gren By the end of the summer, I get tired" asjo at koldfront.dk
Olly writes:> I had a quick look and I think this is because Search::Xapian is still > maintained on the 1.2 branch, and uses a list of the C++ exceptions > from xapian-core 1.2.x. This exception is thrown as WildcardError, > which was added since 1.2.x, so it isn't identified specifically and > the fallback message "something terrible happened" is used instead.Thanks for the explanation, that makes much more sense than what I was vaguely imagining :-) Sounds like I will just modify the test and be happy. Thanks for the help! Adam -- "That's a mystery, but I don't intend to inquire Adam Sj?gren into it further." asjo at koldfront.dk
On Mon, Nov 16, 2020 at 07:07:08PM +0100, Adam Sj?gren wrote:> Adam writes: > > > I've just noticed that set_max_wildcard_expansion() has been removed in > > favour of set_max_expansion() in Xapian. > > > > Has the new method been added to the Perl-bindings? > > Oh, it's there, but only for Xapian 1.5.0+:? > > void > QueryParser::set_max_wildcard_expansion(termcount limit) > CODE: > #if XAPIAN_AT_LEAST(1,5,0) > THIS->set_max_expansion(limit, > Xapian::Query::WILDCARD_LIMIT_ERROR, > Xapian::QueryParser::FLAG_WILDCARD); > #else > THIS->set_max_wildcard_expansion(limit); > #endif > > - QueryParser.xsNo, that's allowing Search::Xapian to build against current git master of xapian-core - the Perl method is still named Search::Xapian::QueryParser::set_max_wildcard_expansion() but calls the replacement C++ method when built with xapian-core >= 1.5.0 (which is what git master reports itself as).> I could only find a tarball of the latest Search::Xapian, but no > repository?It's on the svn/1.2 branch of our git repo, in the search-xapian subdirectory (I plead "historical reasons"). Cheers, Olly