Hi,

in the zimwriter db interface we have now separate fields for url and title. 
They are both used now. Indeed the additional title index is not optional but 
always generated. To reduce overhead in the zim format the title is not stored 
if it is identical to the url. But this is only a implementation detail.

Consequently there are additional methods to find articles by title using the 
suffix "ByTitle" like zim::File::getArticleByTitle(char, const std:.string&). 
It 
is also possible to fetch the nth article by title using 
zim::File::getArticleByTitle(size_type idx). Also there is a find and 
findByTitle as well as findx and findxByTitle.

If you use iterators (zim::File::const_iterator), the iterator itself has an 
attribute, if it iterates by url or title. So you can iterate by url using:

  for (zim::File::const_iterator it = file.begin(); it != file.end(); ++it)
  {
    zim::Article a = *it;
  }

or iterate by title:
  for (zim::File::const_iterator it = file.beginByTitle(); it != file.end(); 
++it)
  {
    zim::Article a = *it;
  }

Keep in mind that there is no file.endByTitle() since the iterator stores 
iternally just the index of the current pointed article. And if the index is 
the number of articles in the file, the iterator is at its end. It makes no 
difference if has reached the last index by url or by title.


Tommi


Am Mittwoch, 6. Januar 2010 11:56:30 schrieb Manuel Schneider:
> Hi,
> 
> see the first item on the Roadmap:
> http://openzim.org/Roadmap
> 
> add Pointer to UrlPointerList (IndexPointerList will be named
> "TitlePointerList")
> 
> and
> 
> add UrlPointerList (article list ordered by URL)
> 
> both already done.
> 
> Regards,
> 
> Manuel
> 
> Am 06.01.2010 11:43, schrieb [email protected]:
> > Hi,
> >
> > during the dev. meeting we have decided to have, in addition to the url
> > sorted index, a title sorted index (at least optional). I can't see it in
> > the roadmap. Is something wrong with it?
> >
> > I have started to play with the trunk again. Until now it works perfectly
> > and I was also able to generate new ZIM files. I will introduce the new
> > format in Kiwix trunk and start to look at the Windows portability.
> >
> > Emmanuel
> >
> >
> >
> > _______________________________________________
> > dev-l mailing list
> > [email protected]
> > https://intern.openzim.org/mailman/listinfo/dev-l
> 
_______________________________________________
dev-l mailing list
[email protected]
https://intern.openzim.org/mailman/listinfo/dev-l

Reply via email to