<div dir="ltr">> `<span style="font-size:12.8px">ptr` is, if I inferred correctly, a `const char *`. (I'm not sure,</span><br style="font-size:12.8px"><span style="font-size:12.8px">> because I don't know why you're incrementing it. Please push your code</span><br style="font-size:12.8px"><span style="font-size:12.8px">> to github if you need further help so people can see the entire</span><br style="font-size:12.8px"><span style="font-size:12.8px">> context of your changes.)</span><br style="font-size:12.8px"><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I've pushed all the changes I made so far </span></div><div><span style="font-size:12.8px"><a href="https://github.com/xapian/xapian/compare/master...ivmarkp:piv+?diff=split&name=piv%2B">https://github.com/xapian/xapian/compare/master...ivmarkp:piv+?diff=split&name=piv%2B</a></span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Can you please add some comments on it? Support for normalization weighting is complete -- just these issues with serialisation.</span><span style="font-size:12.8px"> </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Meanwhile, I'm working on adding an overloaded constructor and pass parameters s and delta to it. Thus, separating the normalization strings</span></div><div><span style="font-size:12.8px">altogether which will be left to the existing constructor to deal with. Does this sound like a viable approach though? </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks, </span></div><div><span style="font-size:12.8px">Vivek</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 6:09 PM, James Aylett <span dir="ltr"><<a href="mailto:james-xapian@tartarus.org" target="_blank">james-xapian@tartarus.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Jul 29, 2016 at 12:35:57AM +0530, Vivek Pal wrote:<br>
<br>
> > I can't tell for sure without seeing the diff. You may mean just<br>
> > `ptr++`? But it could be something else, depending on what you're<br>
> > trying to do.<br>
><br>
> I'm trying to unserialise normalization strings (e.g. "nfn", "nbsl" etc.)<br>
> along with the new double parameters (s and delta) but<br>
> it isn't turning out to be smooth because there's no method for<br>
> unserialising strings in serialise-double.h<br>
<br>
</span>Serialising it about round-tripping numbers through strings. You<br>
shouldn't need to serialise a string; you don't even have to worry<br>
about encoding with those strings, since they're all covered by ASCII<br>
anyway.<br>
<span class=""><br>
> Although, doing just<br>
><br>
> const string normals = ptr++; or, const string normals = static_cast<const<br>
> string>ptr++; fixes compile errors.<br>
<br>
</span>`ptr` is, if I inferred correctly, a `const char *`. (I'm not sure,<br>
because I don't know why you're incrementing it. Please push your code<br>
to github if you need further help so people can see the entire<br>
context of your changes.)<br>
<br>
const string normals = "something";<br>
<br>
will work because there's a suitable constructor. `static_cast<>`<br>
isn't appropriate here (again, providing I've inferred the type of<br>
`ptr` correctly).<br>
<span class=""><br>
> But tfidfweight3 test case is failing with remote backends :-<br>
><br>
> $ ./runtest gdb ./apitest -v tfidfweight3<br>
><br>
> Running test: tfidfweight3... SerialisationError: REMOTE:Bad encoded<br>
> double: short mantissa (context: remote:prog(../bin/xapian-progsrv -t300000<br>
> .glass/db=apitest_simpledata)<br>
<br>
</span>You're deserialising something that wasn't serialised, or wasn't<br>
serialised properly.<br>
<br>
If I put 'xapian bad encoded double short mantissa' into Google, I get<br>
this page as the top result (it may be further down the page for you):<br>
<br>
<a href="https://xapian.org/docs/sourcedoc/html/serialise-double_8cc_source.html" rel="noreferrer" target="_blank">https://xapian.org/docs/sourcedoc/html/serialise-double_8cc_source.html</a><br>
<br>
The error message is at line 173 of unserialise_double. I don't need<br>
to read the code to understand what the error is telling me, because<br>
mantissa is a common term when dealing with floating point numbers<br>
(again, Google is directly fairly helpful here).<br>
<span class=""><br>
> I'm wondering if I need to introduce a new method in serialise-double.h for<br>
> string parameters (normalizations in this case)? To be honest, I have<br>
> little idea about that part of Xapian so probably a workaround might be<br>
> better. :)<br>
<br>
</span>Again: no. And generally, applying a workaround because you don't<br>
understand something isn't a good idea, because how will you know if<br>
the workaround isn't working around some important issues you need to<br>
address directly?<br>
<div class="HOEnZb"><div class="h5"><br>
J<br>
<br>
--<br>
James Aylett, occasional trouble-maker<br>
<a href="http://xapian.org" rel="noreferrer" target="_blank">xapian.org</a><br>
<br>
</div></div></blockquote></div><br></div>