[Xapian-discuss] Problems with positions and replace_document

Fernando Nemec fernando.nemec at folha.com.br
Fri Nov 10 23:18:15 GMT 2006


Hi Olly,

I dig around flint code and I have made a change that seems to fix the
problem. At least fix the problem on my context.

That's the patch. In my case (as the code a post a few hours ago)
there's just one position for each term, so the following patch should
work.

In the other hand, I'm not sure if it works when the positionlist has
more than one element -- actually I didn't test simply because I don't
know how to put more than one position form a single term.

If it doesn't work for a larger positionlist, then I think the
approach is to make a new PositionIterator vector and copy the
positions from term to the new vector. However, I don't know if there
is any performance issue doing that.

Anyway, I'm looking forward to see your comments, Olly.

Thanks again,

Fernando


--- xapian-core-0.9.6/backends/flint/flint_database.cc  2006-05-15 00:43:59.000000000 -0300
+++ xapian-core-0.9.6folha-20061110/backends/flint/flint_database.cc    2006-11-10 21:03:20.000000000 -0200
@@ -863,11 +863,15 @@
                // FIXME : this might not work if we replace a positionlist
                // with itself (e.g. if a document is replaced with itself
                // with just the values changed)
+               Xapian::PositionIterator start = term.positionlist_begin() ;
+               Xapian::PositionIterator end = term.positionlist_end() ;
+
                database_ro.positionlist_table.delete_positionlist(did, tname);
-               if (term.positionlist_begin() != term.positionlist_end()) {
+               if (start != end) {
                    database_ro.positionlist_table.set_positionlist(
                        did, tname,
-                       term.positionlist_begin(), term.positionlist_end());
+                       start, end);
                }
            }
        }




Friday, November 10, 2006, 7:04:56 PM, you wrote:

> On Fri, Nov 10, 2006 at 06:04:15PM -0200, Fernando Nemec wrote:
>> yes, the list is filtering attachments.

> Sorry about that.  Sadly there's no simple answer to spam without
> affecting some non-spam.  I'm starting to wonder if we should switch the
> lists from open posting to moderated for non-subscribers...

>> No problem. I publish my code at this address:
>> 
>> http://mxzypkt.folha.com.br/2006/11/10/xapian/replace.cpp

> OK, that's great - I can reproduce the problem (it turns out that all
> the positional information is lost from the document in this case) and
> will investigate it.  My hunch is that it's likely to be something
> simple to fix.

> Cheers,
>     Olly

--
[]s
Fernando Nemec
fernando.nemec at folha.com.br
http://www.folha.com.br/





More information about the Xapian-discuss mailing list