I've read through the RFC 3501-section 6.5.1 spec but it isn't clear to me on how to structure the BODY to retrieve two sections at once. Individually BODY[1] and BODY[HEADER.FIELDS (SUBJECT TO FROM CC BCC)] are what I want but I would like to do this as a single FETCH.
(BODY[1] BODY[HEADER.FIELDS (SUBJECT TO FROM CC BCC)]) will do it in a single FETCH.
Related
I'm writing batched data over HTTP API like this
demo,state=idle
max=100.0,mean=20.0,event_type=0,probability=0.6,min=0.0 1529087114083
demo,state=idle
max=100.0,mean=80.0,event_type=1,probability=0.6,min=0.0 1529087114083
demo,state=idle
max=100.0,mean=20.0,event_type=2,probability=0.6,min=0.0 1529087114083
demo,state=idle
max=100.0,mean=80.0,event_type=3,probability=0.6,min=0.0 1529087114083
And the request returns 204 which is "ok" according to Influx API docs.
Still, when I want to check my data in admin
SELECT median("mean") AS "median_mean", mean("mean") AS "mean_mean"
FROM "sfb"."autogen"."demo" WHERE time > now() - 1h GROUP BY
:interval: FILL(null)
I get
Your query is syntactically correct but returned no results
Solved: need to specify proper timestamp precision - otherwise it calculates wrong data and data is not visible
If the client does a FETCH with a range of sequence numbers, must the server response give each e-mail in ascending sequence number order?
The RFC3501 contains the following example of a FETCH command.
C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)])
S: * 2 FETCH ....
S: * 3 FETCH ....
S: * 4 FETCH ....
S: A654 OK FETCH completed
Would the following example represent a compliant server?
C: A654 FETCH 2:4 (FLAGS BODY[HEADER.FIELDS (DATE FROM)])
S: * 3 FETCH ....
S: * 4 FETCH ....
S: * 2 FETCH ....
S: A654 OK FETCH completed
I could not find nothing in the sections for FETCH request and FETCH response regarding the order of the response.
You can reorder as much as you want. The paragraph Paurian quotes applies to UID assignment, not to reporting.
It's also safe in practice: Symantec's IMAP proxy (I forget its name, but its job is to scan for naughty attachments and present a santised view of the world to IMAP clients) sends fetch responses in an unpredictable order, and the main developer knows about no problems resulting from that.
From what I understand, No. The sequence must be in order. [See comments, below - as the specs mention storage, not retrieval of order.]
2.3.1.1. Unique Identifier (UID) Message Attribute
A 32-bit value assigned to each message, which when used with the
unique identifier validity value (see below) forms a 64-bit value
that MUST NOT refer to any other message in the mailbox or any
subsequent mailbox with the same name forever. Unique identifiers
are assigned in a strictly ascending fashion in the mailbox; as each
message is added to the mailbox it is assigned a higher UID than the
message(s) which were added previously. Unlike message sequence
numbers, unique identifiers are not necessarily contiguous.
Since these are sequence numbers, the result must be contiguous.
Articld 6.4.8. implies that FETCH without the UID prefix indicates a sequence search rather than a unique identifier within your range expression:
... the UID command (variant) takes a SEARCH command with
SEARCH command arguments. The interpretation of the arguments is
the same as with SEARCH; however, the numbers returned in a SEARCH
response for a UID SEARCH command are unique identifiers instead
Source: https://www.rfc-editor.org/rfc/rfc3501
I need to model a forum with Neo4j. I have "forums" nodes which have messages and, optionally, these messages have replies: forum-->message-->reply
The cypher query I am using to retrieve the messages of a forum and their replies is:
start forum=node({forumId}) match forum-[*1..]->msg
where (msg.parent=0 and msg.ts<={ts} or msg.parent<>0)
return msg ORDER BY msg.ts DESC limit 10
This query retrieves the messages with time<=ts and all their replies (a message has parent=0 and a reply has parent<>0)
My problem is that I need to retrieve pages of 10 messages (limit 10) independently of the number or replies.
For example, if I had 20 messages and the first one with 100 replies, it would only return 10 rows: the first message and 9 replies but I need the first 10 messages and the 100 replies of the first one.
How can I limit the result based on the number of messages and not their replies?
The ts property is indexed, but is this query efficient when mixing it with other where clauses?
Do you know a better way to model this kind of forum with Neo?
Supposing you switch to labels and avoid IDs (as they can be recycled and therefore are not stable identifiers):
MATCH (forum:FORUM)<--(message:MESSAGE {parent:0})
WHERE forum.name = '%s' // where %s identifies the forum in a *stable* way
WITH message // using a subquery allows to apply LIMIT only to main messages
ORDER BY message.ts DESC
LIMIT 10
OPTIONAL MATCH (message)<-[:REPLIES_TO]-(replies)
RETURN message, replies
The only important change here is to split the reply and message matching in two sub-queries, so that the LIMIT clause applies to the first subquery only.
However, you need to link the relevant replies to the matched main messages in the second subquery (I introduced a fictional relationship REPLIES_TO to link replies to messages).
And when you need to fetch page 2,3,4 etc.
You need an extra parameter (which the biggest message timestamp of the previous page, let's say previous_timestamp).
The first sub-query WHERE clause becomes:
WHERE forum.name = '%s' AND message.ts > previous_timestamp
I have to create some data in CoreData entities in batch (import process) and I would like to "commit" at the end or "rollback" on an error (so saving inbetween won't work).
The problem is that I for example need to create an entity "Person" and later in that progress I need to re-use that entity. BUT it can already exists BEFORE this process or may be created WHILE this import process.
So I'm trying to fetch it with a predicate "(personId == 4711)". But although I have set
[fetchRequest setIncludesPendingChanges:YES]; it doesn't find the newly created Person object.
I read this this question and this answer which state, that it is not possible? Am I right?
If so, how can I workaround / handle this?
From what I know of CoreData, this is indeen impossible (please correct me if I'm wrong).
However, even if this was possible, you never want to query your store on a "per object" basis.The performance impact on large (more then a few dozens) imports is huge.
My suggestion for you is to create a dictionary keyed by your unique identifier during the import stage (prefetch from the store existing entities and create new ones for ones that aren't).
Note: You should be careful not to perform multiple inserts from different contexts in a multithreaded environment. in such cases you will need a coordinator to prevent duplications.
example:
store content: 1 --> P1, 3 --> P3
service response: 1 --> Data1, 2 --> Data2
Algorithm:
on response completion, get all unique ids from response --> recievedIds = #[1,2]
during the creation of recievedIds set create a mapping/dictionary of personId --> data:
#{1 : Data1, 2 : Data2}
fetch from the store by predicate:
[NSPredicate predicateWithFormat:#"personId IN %#",recievedIds]
Create a dictionary from the resulting array.
in this case: existingItems = #{1 : P1}
Pass over all ids in recievedIds:
1) if the id exist in existingItems update the existing object
2) else create a new person and insert the data to the new record.
This will only fetch from the store once.
And you only save once.
==> only 2 trips to the store instead of a trip per object
I'd like to download the text (that is mime type text/plain, text/html text/richtext) from UID x to UID y.
I have the UID's (and not mailbox IDs).
How can I do something like
FETCH 412444:412500 (BODY.PEEK[TEXT/PLAIN OR TEXT/HTML OR TEXT/RICHTEXT])
Thanks!
After checking RFC3501, the UID command (section 6.4.8) seems to be able to do part of this:
The UID command has two forms. In the first form, it takes as its
arguments a COPY, FETCH, or STORE command with arguments
appropriate for the associated command. However, the numbers in
the sequence set argument are unique identifiers instead of
message sequence numbers. Sequence set ranges are permitted, but
there is no guarantee that unique identifiers will be contiguous.
Thus, you should be able to call:
UID FETCH 412444:412500 (BODY.PEEK[TEXT/PLAIN OR TEXT/HTML OR TEXT/RICHTEXT])