[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Demexp-dev] Retrieving Tag List
From: |
David MENTRE |
Subject: |
Re: [Demexp-dev] Retrieving Tag List |
Date: |
Sat, 20 Oct 2007 12:04:47 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Hi Lyu,
Lyu Abe <address@hidden> writes:
> I'm not sure I understood what the method "max_tag_id(cookie)" was for:
> in the demexp book, it is described as "Method max_tag_id returns a
> structure containing the biggest tag identifier on the server."
>
> But I found weird that the function returned exactly the number of
> questions on the server.
max_question_id() returns the id of the latest question on the server.
max_tag_id() returns the id of the latest tag on the server.
> Moreover, when I used the "tag_set_of_question_group(cookie,id,id+N)"
> with N being the number above (and id=0), I got a server error saying
> that N is too large (which is probably the case because there should be
> less tags than the total number of questions).
There are an error and a misunderstanding.
* To avoid denial of service on the server, N is limited to a
reasonnable size (currently 100). This is the constant MAX_NUMBER_IDS
in the XDR description. You can dynamically get its value bye calling
the XML-RPC constants() on the demexp XML-RPC proxy;
* In all demexp RPCs, the `number' parameter is always the number of
items (tags, questions, etc.) you want to get. So in your above
example, you should call:
tag_set_of_question_group(cookie, id, N) ("N" instead of "id+N")
So, if we consider we have 273 questions on the server, you should
do:
set1 = tag_set_of_question_group(cookie, 0, 100)
set2 = tag_set_of_question_group(cookie, 100, 100)
set3 = tag_set_of_question_group(cookie, 200, 73)
unpack set1, set2 and set3 to get the tags assigned to each question
with id in 0 to 272.
use tag_info() to get the label of a group of tags, in the same way
as question_info()
Of course, you can get tags assigned to question by group of 50
instead of 100 if you prefer. But, as I said before, the less number
of RPC calls the better. :-)
If you have some persistent state on your web server side (e.g. a
database), you might store the retrieved tags or tags assigned to a
given question from your local state. That might improve
performance. But in that case you need maintain coherence with the
server in case of changes with timetsamps. We might see this at a later
time. ;-)
Many thanks for the time you invest in demexp,
Yours,
d.
--
GPG/PGP key: A3AD7A2A David MENTRE <address@hidden>
5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A