OK, thank you Manuel. This was a misunderstanding by me.
I have achieved to have different "title" and "url" per article in my test ZIM file, so the zimwriter deals from now by me correctly with the DB "url" and "title" fields. :)
But, I was not able to check the title index: * Do we have a way with zimDump for example to get all article titles starting with "open" for example? * the zimreader has a suggest feature (able to propose articles URLs which start with the first characters you have typed). Where is the zimreader code which does that ? Is it easy to adapt it to do the same with titles?
Emmanuel
Le mer 06/01/10 11:56, "Manuel Schneider" manuel.schneider@wikimedia.ch a écrit:
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 emmanu el@engelhart.org: 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
dev-l@openz
im.org https://intern.openzim.org/mailman/listinfo/dev-l
-- Regards Manuel Schneider
Wikimedia CH - Verein zur Förderung Freien Wissens Wikimedia CH - Association for the advancement of free knowledge www.wikimedia.ch
But, I was not able to check the title index:
- Do we have a way with zimDump for example to get all article titles
starting with "open" for example? * the zimreader has a suggest feature (able to propose articles URLs which start with the first characters you have typed). Where is the zimreader code which does that ? Is it easy to adapt it to do the same with titles?
There is a flag -t in zimDump, which switches to search by title. I just realized that this is missing on the help page. I will add that.
To find a article by title use: zimDump -t -i -f "MyTitle" myzimfile.zim
To use it in your application use iterators:
zim::File::const_iterator it = zimFile.find('A', "MyUrl"); or zim::File::const_iterator it = zimFile.findByTitle('A', "MyTitle");
This will return a iterator to the first article whose url (or title) is equal or greater than the passed string. You have to compare the iterator against zimFile.end() to check, if it points really to a valid article. If you look for a range of articles starting with a specific url (or title) you have to do that manually e.g.: zim::File::const_iterator itFirst = zimFile.find('A', "MyUrl"); zim::File::const_iterator itLast = zimFile.find('A', "MyUrm");
or by comparing yourself: for (zim::File::const_iterator it = zimFile.find('A', "MyUrl"); it != zimFile.end() && it->getUrl().compare(0, 5, "MyUrl") == 0) ++it) { }
Tommi
Hi Tommi,
thanks for your explanations.
Could you both please add your knowledge on existing methods and how to use them properly add into the wiki?
We have already started a page for that:
Thanks!
Manuel
Am 06.01.2010 14:27, schrieb Tommi Mäkitalo:
But, I was not able to check the title index:
- Do we have a way with zimDump for example to get all article titles starting with "open" for example? * the zimreader has a suggest feature (able to propose articles URLs which start with the first characters you have typed). Where is the zimreader code which does that ? Is it easy to adapt it to do the same with titles?
There is a flag -t in zimDump, which switches to search by title. I just realized that this is missing on the help page. I will add that.
To find a article by title use: zimDump -t -i -f "MyTitle" myzimfile.zim
To use it in your application use iterators:
zim::File::const_iterator it = zimFile.find('A', "MyUrl"); or zim::File::const_iterator it = zimFile.findByTitle('A', "MyTitle");
This will return a iterator to the first article whose url (or title) is equal or greater than the passed string. You have to compare the iterator against zimFile.end() to check, if it points really to a valid article. If you look for a range of articles starting with a specific url (or title) you have to do that manually e.g.: zim::File::const_iterator itFirst = zimFile.find('A', "MyUrl"); zim::File::const_iterator itLast = zimFile.find('A', "MyUrm");
or by comparing yourself: for (zim::File::const_iterator it = zimFile.find('A', "MyUrl"); it != zimFile.end()&& it->getUrl().compare(0, 5, "MyUrl") == 0) ++it) { }
Tommi _______________________________________________ dev-l mailing list dev-l@openzim.org https://intern.openzim.org/mailman/listinfo/dev-l