Loading ...
Sorry, an error occurred while loading the content.

SearchMessages Not Finding The Message

Expand Messages
  • Wayne
    Here is the code I have got: ///////////////////////////////////////////////// SearchMessages searchRequest = new SearchMessages(); searchRequest.search = new
    Message 1 of 12 , Sep 1, 2007
    • 0 Attachment
      Here is the code I have got:

      /////////////////////////////////////////////////

      SearchMessages searchRequest = new SearchMessages();
      searchRequest.search = new SearchQuery();
      searchRequest.search.subject = key;
      searchRequest.search.subjectmatchmode = SearchMatchMode.exact;
      searchRequest.search.subjectmatchmodeSpecified = true;
      searchRequest.search.fid = new String[] { fid };
      searchRequest.search.searchtype = SearchType.header;
      searchRequest.search.dateSpecified = false;
      searchRequest.search.bodymatchmodeSpecified = false;
      searchRequest.search.attachmenttypeSpecified = false;
      searchRequest.search.frommatchmodeSpecified = false;

      searchRequest.startInfoSpecified = false;
      searchRequest.numInfoSpecified = false;
      searchRequest.startMidSpecified = false;

      searchRequest.numMid = 1;
      searchRequest.numMidSpecified = true;

      ListMessagesResponse sr = Instance.SearchMessages(searchRequest);

      ////////////////////////////////////////////

      I have a mail message that exactly matches the subject presented in
      key, however it is not finding it. I assume it looking at one of the
      other fields to find the match, or SearchType is wrong. SearchType
      isn't documented very well. Also, this is a SavedMessage, not a
      email that is inbound, does that matter? The search searchs saved
      message right?

      This is .NET

      -Wayne
    • Ryan Kennedy
      ... What happens if you change the first line? searchRequest.startMidSpecified = true; searchRequest.startMid = 0; You re not giving the WS any indication
      Message 2 of 12 , Sep 1, 2007
      • 0 Attachment
        --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@...> wrote:
        > searchRequest.startMidSpecified = false;
        >
        > searchRequest.numMid = 1;
        > searchRequest.numMidSpecified = true;

        What happens if you change the first line?

        searchRequest.startMidSpecified = true;
        searchRequest.startMid = 0;

        You're not giving the WS any indication where in the results you'd
        like to begin.

        To answer your other question, searching saved messages does work.
        There are times, however, when the search index manages to get itself
        out of sync with the mailbox. To test for that condition, log into
        Yahoo! Mail and do a search for the subject. If the message doesn't
        show up, there's a chance the index is out of sync. If that happens,
        let me know. I can force a re-sync of your index.

        Ryan Kennedy
        Yahoo! Mail Web Service
      • Wayne
        SearchMessages searchRequest = new SearchMessages(); searchRequest.search = new SearchQuery(); searchRequest.search.subject = key;
        Message 3 of 12 , Sep 2, 2007
        • 0 Attachment
          SearchMessages searchRequest = new SearchMessages();

          searchRequest.search = new SearchQuery();
          searchRequest.search.subject = key;
          searchRequest.search.subjectmatchmode = SearchMatchMode.exact;
          searchRequest.search.subjectmatchmodeSpecified = true;
          searchRequest.search.fid = new String[] { fid };
          searchRequest.search.searchtype = SearchType.header;
          searchRequest.search.dateSpecified = false;
          searchRequest.search.bodymatchmodeSpecified = false;
          searchRequest.search.attachmenttypeSpecified = false;
          searchRequest.search.frommatchmodeSpecified = false;

          searchRequest.startInfoSpecified = false;
          searchRequest.numInfoSpecified = false;

          searchRequest.startMid = 0;
          searchRequest.startMidSpecified = true;
          searchRequest.numMid = 1;
          searchRequest.numMidSpecified = true;

          ListMessagesResponse sr = Instance.SearchMessages(searchRequest);

          Here is what I have now, still no luck. Whould it help if I built a
          quick console application, and sent you the source and binary?

          -Wayne

          --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@...> wrote:
          >
          > --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@> wrote:
          > > searchRequest.startMidSpecified = false;
          > >
          > > searchRequest.numMid = 1;
          > > searchRequest.numMidSpecified = true;
          >
          > What happens if you change the first line?
          >
          > searchRequest.startMidSpecified = true;
          > searchRequest.startMid = 0;
          >
          > You're not giving the WS any indication where in the results you'd
          > like to begin.
          >
          > To answer your other question, searching saved messages does work.
          > There are times, however, when the search index manages to get
          itself
          > out of sync with the mailbox. To test for that condition, log into
          > Yahoo! Mail and do a search for the subject. If the message doesn't
          > show up, there's a chance the index is out of sync. If that happens,
          > let me know. I can force a re-sync of your index.
          >
          > Ryan Kennedy
          > Yahoo! Mail Web Service
          >
        • Ryan Kennedy
          ... Yeah, that would be good. I can have a look this evening and see what s up. Ryan Kennedy Yahoo! Mail Web Service
          Message 4 of 12 , Sep 4, 2007
          • 0 Attachment
            --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@...> wrote:
            > Here is what I have now, still no luck. Whould it help if I built a
            > quick console application, and sent you the source and binary?

            Yeah, that would be good. I can have a look this evening and see
            what's up.

            Ryan Kennedy
            Yahoo! Mail Web Service
          • Wayne
            Ryan, I was making you the test application, and figure out the issue. It appears that if you have a subject with a colon : in it, that this syntax:
            Message 5 of 12 , Sep 4, 2007
            • 0 Attachment
              Ryan,

              I was making you the test application, and figure out the issue. It
              appears that if you have a subject with a colon ':' in it, that this
              syntax:

              searchRequest.search.subject = "name:value";
              searchRequest.search.subjectmatchmode = SearchMatchMode.exact;
              searchRequest.search.subjectmatchmodeSpecified = true;

              Doesn't Find What You Are Looking For. Assuming that that the subject
              is "name:value". It probably has to do with the fact that : is
              reserved for this parameter:

              searchRequest.search.query = string.Format("subject:\"{0}\"");

              However, it doesn't make sense that my "Exact" can't use a colon. Can
              you confirm, and let me know if this is a bug or by design, and if it
              will be fixed, or maybe I can escape the colon somehow?

              I would use the searchRequest.search.query, however I don't know if
              that is an exact match or a contains, and how to syntacially represent
              what I want.

              Thanks,
              Wayne



              --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@...> wrote:
              >
              > --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@> wrote:
              > > Here is what I have now, still no luck. Whould it help if I built
              a
              > > quick console application, and sent you the source and binary?
              >
              > Yeah, that would be good. I can have a look this evening and see
              > what's up.
              >
              > Ryan Kennedy
              > Yahoo! Mail Web Service
              >
            • Ryan Kennedy
              ... An alternative to this would be to use this instead: searchRequest.search.query = subject: name:value ; That s almost an identical search. I think the
              Message 6 of 12 , Sep 4, 2007
              • 0 Attachment
                --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@...> wrote:
                > searchRequest.search.subject = "name:value";
                > searchRequest.search.subjectmatchmode = SearchMatchMode.exact;
                > searchRequest.search.subjectmatchmodeSpecified = true;

                An alternative to this would be to use this instead:

                searchRequest.search.query = "subject:\"name:value\"";

                That's almost an identical search. I think the only difference is that
                you'll get substring matches, whereas your snippet does only exact
                matches.

                I'm talking to some of the search people internally to find out why
                setting the subject and subjectmatchmode aren't working. I'll get back
                to you on that. In the meantime, you might consider using the query
                instead if that works for you.

                Ryan Kennedy
                Yahoo! Mail Web Service
              • Wayne Berry
                Ryan, Thanks for the work around, I am just going to use another delimiter besides colon. I need the exact match to work with my application. However, I
                Message 7 of 12 , Sep 4, 2007
                • 0 Attachment

                  Ryan,

                   

                  Thanks for the work around, I am just going to use another delimiter besides colon.  I need the exact match to work with my application.  However, I still think that this is a bug and if you get it fixed let me know.

                   

                  - Wayne

                   


                  From: ydn-mail@yahoogroups.com [mailto:ydn-mail@yahoogroups.com] On Behalf Of Ryan Kennedy
                  Sent: Tuesday, September 04, 2007 3:54 PM
                  To: ydn-mail@yahoogroups.com
                  Subject: [ydn-mail] Re: SearchMessages Not Finding The Message

                   

                  --- In ydn-mail@yahoogroup s.com, "Wayne" < wayne @...> wrote:

                  > searchRequest. search.subject = "name:value" ;
                  > searchRequest. search.subjectma tchmode = SearchMatchMode. exact;
                  > searchRequest. search.subjectma tchmodeSpecified = true;

                  An alternative to this would be to use this instead:

                  searchRequest. search.query = "subject:\"name: value\"";

                  That's almost an identical search. I think the only difference is that
                  you'll get substring matches, whereas your snippet does only exact
                  matches.

                  I'm talking to some of the search people internally to find out why
                  setting the subject and subjectmatchmode aren't working. I'll get back
                  to you on that. In the meantime, you might consider using the query
                  instead if that works for you.

                  Ryan Kennedy
                  Yahoo! Mail Web Service

                • Wayne
                  Ryan, Well Almost got it, however still having a little trouble. If I take the mid returned from the SearchMessage and call GetMessage right away with it, It
                  Message 8 of 12 , Sep 4, 2007
                  • 0 Attachment
                    Ryan,

                    Well Almost got it, however still having a little trouble. If I take
                    the mid returned from the SearchMessage and call GetMessage right
                    away with it, It can't find the message. Also, the mid being
                    returned from the search is different then the mid returned from the
                    SaveMessage. It happens to be the only message in the folder (since
                    I have a unique fid).

                    Here is the code:

                    // WWB: Create Folder With Unique Name
                    CreateFolder createFolder = new CreateFolder();
                    createFolder.name = System.Guid.NewGuid().ToString();
                    CreateFolderResponse createFolderResponse = ymwsInstance.CreateFolder
                    (createFolder);
                    fid = createFolderResponse.folderInfo.fid;

                    String key = String.Format("{0}",System.Guid.NewGuid().ToString());

                    // WWB: Create Message With Unqiue Subject
                    SaveMessage saveRequest = new SaveMessage();
                    saveRequest.destination = new SaveMessageDestination();
                    saveRequest.destination.fid = fid;
                    saveRequest.message = new ComposeMessage();
                    saveRequest.message.from = new Address();
                    saveRequest.message.from.name =
                    UserData.data.userSendPref.defaultFromName;
                    saveRequest.message.from.email =
                    UserData.data.userSendPref.defaultFromAddress;
                    saveRequest.message.subject = key;
                    saveRequest.message.simplebody = new SimpleMessageBody();
                    saveRequest.message.simplebody.text = "test";
                    String[] savedMids = ymwsInstance.SaveMessage(saveRequest);
                    mid = (savedMids[0]);

                    // WWB: Find The Message
                    SearchMessages searchRequest = new SearchMessages();
                    searchRequest.search = new SearchQuery();
                    searchRequest.search.subject = key;
                    searchRequest.search.subjectmatchmode = SearchMatchMode.exact;
                    searchRequest.search.subjectmatchmodeSpecified = true;
                    searchRequest.search.fid = new String[] {fid};
                    searchRequest.search.searchtype = SearchType.header;
                    searchRequest.search.dateSpecified = false;
                    searchRequest.search.bodymatchmodeSpecified = false;
                    searchRequest.search.attachmenttypeSpecified = false;
                    searchRequest.search.frommatchmodeSpecified = false;

                    searchRequest.startInfoSpecified = false;
                    searchRequest.numInfoSpecified = false;

                    searchRequest.startMid = 0;
                    searchRequest.startMidSpecified = true;
                    searchRequest.numMid = 1;
                    searchRequest.numMidSpecified = true;

                    ListMessagesResponse searchResponse = ymwsInstance.SearchMessages
                    (searchRequest);

                    if (searchResponse.mid[0] != mid)
                    {
                    // WWB: They Are Not Equal
                    }

                    GetMessage getRequest = new GetMessage();
                    getRequest.fid = fid;
                    getRequest.mid = new String[] { searchResponse.mid[0] };
                    // WWB: This Fails
                    GetMessageResponse getMessageResponse = ymwsInstance.GetMessage
                    (getRequest);

                    Error:

                    Failed to get msginfo on message id
                    1_22_24_22_0_APswvs4AAJz4Rt4VxgdTAnBfoyo

                    -Wayne
                  • Ryan Kennedy
                    ... Yeah, you ve stumbled on a bit of the underlying implementation leaking through. When you call SearchMessages, the response should include a fid for the
                    Message 9 of 12 , Sep 4, 2007
                    • 0 Attachment
                      --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@...> wrote:
                      > Well Almost got it, however still having a little trouble. If I take
                      > the mid returned from the SearchMessage and call GetMessage right
                      > away with it, It can't find the message. Also, the mid being
                      > returned from the search is different then the mid returned from the
                      > SaveMessage. It happens to be the only message in the folder (since
                      > I have a unique fid).

                      Yeah, you've stumbled on a bit of the underlying implementation
                      leaking through. When you call SearchMessages, the response should
                      include a fid for the search "folder". You need to pass that fid to
                      GetMessage instead of passing the fid of the actual folder. The mid
                      returned by SearchMessages is kind of a virtual mid for the search
                      "folder". It basically allows search results to act more like a true
                      folder to make displaying search results in a message list more
                      convenient.

                      Ryan Kennedy
                      Yahoo! Mail Web Service
                    • Wayne Berry
                      Ryan, You have been a great help. -Wayne _____ From: ydn-mail@yahoogroups.com [mailto:ydn-mail@yahoogroups.com] On Behalf Of Ryan Kennedy Sent: Tuesday,
                      Message 10 of 12 , Sep 5, 2007
                      • 0 Attachment

                        Ryan,

                         

                        You have been a great help.

                         

                        -Wayne

                         


                        From: ydn-mail@yahoogroups.com [mailto:ydn-mail@yahoogroups.com] On Behalf Of Ryan Kennedy
                        Sent: Tuesday, September 04, 2007 9:24 PM
                        To: ydn-mail@yahoogroups.com
                        Subject: [ydn-mail] Re: SearchMessages Not Finding The Message

                         

                        --- In ydn-mail@yahoogroup s.com, "Wayne" < wayne @...> wrote:

                        > Well Almost got it, however still having a little trouble. If I take
                        > the mid returned from the SearchMessage and call GetMessage right
                        > away with it, It can't find the message. Also, the mid being
                        > returned from the search is different then the mid returned from the
                        > SaveMessage. It happens to be the only message in the folder (since
                        > I have a unique fid).

                        Yeah, you've stumbled on a bit of the underlying implementation
                        leaking through. When you call SearchMessages, the response should
                        include a fid for the search "folder". You need to pass that fid to
                        GetMessage instead of passing the fid of the actual folder. The mid
                        returned by SearchMessages is kind of a virtual mid for the search
                        "folder". It basically allows search results to act more like a true
                        folder to make displaying search results in a message list more
                        convenient.

                        Ryan Kennedy
                        Yahoo! Mail Web Service

                      • Ryan Kennedy
                        ... We ve been discussing this internally and it does seem that it s a bug. I think you re probably the only person using exact subject matches with these
                        Message 11 of 12 , Sep 5, 2007
                        • 0 Attachment
                          --- In ydn-mail@yahoogroups.com, "Wayne Berry" <wayne@...> wrote:
                          > Thanks for the work around, I am just going to use
                          > another delimiter besides colon. I need the exact match
                          > to work with my application. However, I still think that
                          > this is a bug and if you get it fixed let me know.

                          We've been discussing this internally and it does seem that it's a
                          bug. I think you're probably the only person using exact subject
                          matches with these special characters, which is why this hasn't come
                          up before (although it's embarrassing that this made it through QA).

                          I wouldn't count on any quick fixes from our end, so using the query
                          workaround is probably your best bet for now. Alternatively, you could
                          quote the subject you put in the "subject" field, but that may end up
                          breaking later when we fix the underlying bug.

                          For now, I'd suggest using the query and doing some post processing to
                          see if the hits you get back are exact matches or not. I know it's
                          inconvenient, but it's really your best bet for right now.

                          Ryan Kennedy
                          Yahoo! Mail Web Service
                        • Wayne
                          So if I do a search and get a different mid and fid back, what should I send to DeleteMessage? If I send the Search Folder fid and mid, will it just delete
                          Message 12 of 12 , Sep 5, 2007
                          • 0 Attachment
                            So if I do a search and get a different mid and fid back, what should I
                            send to DeleteMessage? If I send the Search Folder fid and mid, will
                            it just delete the message out of the search folder and not it's "true"
                            folder?

                            -Wayne

                            --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@...> wrote:
                            >
                            > --- In ydn-mail@yahoogroups.com, "Wayne" <wayne@> wrote:
                            > When you call SearchMessages, the response should
                            > include a fid for the search "folder". You need to pass that fid to
                            > GetMessage instead of passing the fid of the actual folder. The mid
                            > returned by SearchMessages is kind of a virtual mid for the search
                            > "folder".
                          Your message has been successfully submitted and would be delivered to recipients shortly.