Skip to content

Commit

Permalink
Issue #9
Browse files Browse the repository at this point in the history
  • Loading branch information
grosjo committed Apr 3, 2019
1 parent b0bf3dc commit 9e74068
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/fts-backend-xapian-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,26 +690,27 @@ bool fts_backend_xapian_index_hdr(Xapian::WritableDatabase * dbx, uint uid, cons

if(i>=HDRS_NB) return true;
const char * h=hdrs_xapian[i];

XHeaderTerm xhs(p,f,strcmp(h,"XMID")==0);
xhs.add(data);

char *t = (char*)i_malloc(sizeof(char)*(xhs.maxlength+6));

for(i=0;i<xhs.size;i++)
{
snprintf(t,xhs.maxlength+6,"%s%s",h,xhs.data[i]);
try
{
doc.add_term(t);
}
catch(Xapian::Error e)
XHeaderTerm * xhs = new XHeaderTerm(p,f,strcmp(h,"XMID")==0);
xhs->add(data);

char *t = (char*)i_malloc(sizeof(char)*(xhs->maxlength+6));

for(i=0;i<xhs->size;i++)
{
i_error("Xapian: %s",e.get_msg().c_str());
snprintf(t,xhs->maxlength+6,"%s%s",h,xhs.data[i]);
try
{
doc.add_term(t);
}
catch(Xapian::Error e)
{
i_error("Xapian: %s",e.get_msg().c_str());
}
}
i_free(t);
delete(xhs);
}
i_free(t);

dbx->replace_document(docid,doc);
return true;
}
Expand Down

0 comments on commit 9e74068

Please sign in to comment.