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