Issue 49: Snippets are not retrievable
Status:  New
Owner: ----
Reported by rdc...@gmail.com, Aug 9, 2008
What steps will reproduce the problem?
1. Using Visual C++ MFC Application using the native query api (com 
versions), the uri, content, timestamp, and date properties are obtainable 
with no errors.  However using 'snippet' or 'summary' results in no values.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
Google Desktop SDK from 19 May 2008 (latest version - downloaded 8/10/08) 
with Google Desktop Google Desktop 5.7.0806.10245-en-pb



Please provide any additional information below.
Here is some sample code I developed that illustrates the program:

I have written an MFC Windows Application using the Native Query API set 
(not a gadget).  Most everything seems to work correctly with the major 
exception of being able to access the snippet information.

The C++ code is fairly straight forward and most of the properties I ask 
for using the set->next functions are returned properly.  What I haven't 
been able to get is the snippet information no matter what property I use.


Here is some of the abbreviated code fragment for the search:


  HRESULT hr = spQuery.CoCreateInstance(CLSID_GoogleDesktopQueryAPI);


        hr = spQuery->Query(cookie, our_query, category, ranking, &set);
        CComBSTR prop_uri("uri");
        CComBSTR prop_folder("folder_name");
        CComBSTR prop_displayName("display_name");
        CComBSTR prop_content("content");
        CComBSTR prop_summary("text_content");
        CComBSTR prop_timestamp("timestamp");
        CComBSTR prop_date("last_modified_time");
        CComBSTR prop_snippet("snippet");


   // Property Items                            // Result Status from
set->next
  VARIANT propURI;                             // Returns correctly
  VARIANT propFolder;                         // Returns NULL
  VARIANT propDisplayName;               // Returns NULL
  VARIANT propContent;                       // Return file content
  VARIANT propSummary;                    // Returns file content
(same as prev)
  VARIANT propTimestamp;                  // This is the date it was
indexed.
  VARIANT propDate;                           // Returns creation date
(not modified)
  VARIANT propSnippet;                       // Returns nothing ????


        while(1) {
                hr = set->Next(&resultItem);
                if(resultItem == NULL)
                        break;
                resultItem->GetProperty(prop_uri, &propURI);
                resultItem->GetProperty(prop_folder, &propFolder);
                resultItem->GetProperty(prop_displayName,
&propDisplayName);
                resultItem->GetProperty(prop_content, &propContent);
                resultItem->GetProperty(prop_summary, &propSummary);
                resultItem->GetProperty(prop_timestamp,
&propTimestamp);
                resultItem->GetProperty(prop_date, &propDate);
                resultItem->GetProperty(prop_snippet, &propSnippet);


        }


If anyone has a solution, I would be most appreciative.


Thanks,
RDCS




 
Aug 17, 2008
#1 rdc...@gmail.com
I figured it out, finally!!!  You must create a resultItem2 using the 
IGoogleDesktopQueryResultItem2, i.e.   
CComPtr<IGoogleDesktopQueryResultItem2> resultItem2;
and then make this equal to the IGoogleDesktopQueryResultItem which was previously 
defined.  Using the IGoogleDesktopQueryResultItem2 you can then access the method 
GetSnippet(...) to obtain the snippets.