jgd.comapi
Class QueryResultItem

java.lang.Object
  extended by jgd.comapi.QueryResultItem
All Implemented Interfaces:
IJGDResultItem, ResultsType.ResultType
Direct Known Subclasses:
QueryResultIteratorItem

public class QueryResultItem
extends java.lang.Object
implements IJGDResultItem

Class for representing one single search-result -entry within a set of results returned by a GD query

Author:
Arne Solheim (Protector Forsikring ASA - www.protectorforsikring.no)
See Also:
QueryResultSet

Field Summary
private  java.text.SimpleDateFormat dateformat
           
private  int itemNumber
           
private static int MAX_SNIPPET_LENGTH
           
private  java.util.Map<java.lang.String,java.lang.String> properties
           
private  java.lang.String queryString
           
private  java.lang.String schema
           
private  java.lang.String snippet
           
 
Constructor Summary
QueryResultItem(java.lang.String queryString)
           
 
Method Summary
protected  void calculateSnippet()
          It seems that the current Native GD API does not support obtaining a summary/snippet of a search-result -entry (the documentation on http://desktop.google.com/queryapi.html#individualresult mentions a summary -property, but this property is not listed in the complete set of properties)
 java.lang.String getCacheUrl()
          cache_url is the Google Desktop Search-relative URL of this result's internal cache page.
 java.lang.String getCategory()
          contains the result's type, one of: email, chat, web, file, contact, calendar, task, journal, note.
 long getDocId()
          doc_id is the result's GDS internal identifier for doc.
 long getEventId()
          event_id is the result's GDS internal identifier for event.
 java.lang.String getFlags()
          Undocumented by google (Only for Desktop2)
 int getFormat()
           
 java.lang.String getFrom()
          from is the name of either the person an email message was from, or the other party in a Instant Message chat.
 java.lang.String getIcon()
          Deprecated.  
 long getId()
          id is the result's GDS internal identifier.
 int getItemNumber()
           
 java.lang.String getMessageId()
          Undocumented by google (Only for Desktop2)
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          See http://desktop.google.com/queryapi.html#individualresult
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.String getSchema()
          See http://desktop.google.com/queryapi.html#individualresult
 java.lang.String getSnippet()
          snippet is a snippet from the result's content that contains at least one of the search terms.
 java.lang.String getTextContent()
           
 java.lang.String getThumbnail()
          thumbnail is a relative URL to the icon for this result at the GDS webserver
 java.math.BigInteger getTime()
          time is the time value from the event that put this content into GDS.
 java.util.Date getTimestamp()
           
 java.lang.String getTitle()
          title is the result's title, which varies depending on its type: Web page: the page's title.
 java.lang.String getURI()
          See http://desktop.google.com/queryapi.html#individualresult
 java.lang.String getUrl()
          url is the result's URL.
 void setCacheUrl(java.lang.String value)
          cache_url is the Google Desktop Search-relative URL of this result's internal cache page.
 void setCategory(java.lang.String value)
          contains the result's type, one of: email, chat, web, file, contact, calendar, task, journal, note.
 void setDocId(long value)
          doc_id is the result's GDS internal identifier for doc.
 void setEventId(long value)
          event_id is the result's GDS internal identifier for event.
 void setFlags(java.lang.String value)
          Undocumented by google (Only for Desktop2)
 void setFrom(java.lang.String value)
          from is the name of either the person an email message was from, or the other party in a Instant Message chat.
 void setIcon(java.lang.String value)
          icon is a Google Desktop Search-relative URL to an icon representing this result or its type.
 void setId(long value)
          id is the result's GDS internal identifier.
 void setItemNumber(int itemNumber)
          Should only be used internally by the GDS Java API
 void setMessageId(java.lang.String value)
          Undocumented by google (Only for Desktop2)
 void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
          See http://desktop.google.com/queryapi.html#individualresult
 void setSchema(java.lang.String schema)
          See http://desktop.google.com/queryapi.html#individualresult
 void setSnippet(java.lang.String snippet)
          snippet is a snippet from the result's content that contains at least one of the search terms.
 void setThumbnail(java.lang.String value)
          thumbnail is a relative URL to the icon for this result at the GDS webserver
 void setTime(java.math.BigInteger value)
          time is the time value from the event that put this content into GDS.
 void setTitle(java.lang.String value)
          title is the result's title, which varies depending on its type: Web page: the page's title.
 void setUrl(java.lang.String value)
          url is the result's URL.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SNIPPET_LENGTH

private static final int MAX_SNIPPET_LENGTH
See Also:
Constant Field Values

schema

private java.lang.String schema

itemNumber

private int itemNumber

snippet

private java.lang.String snippet

properties

private java.util.Map<java.lang.String,java.lang.String> properties

dateformat

private java.text.SimpleDateFormat dateformat

queryString

private java.lang.String queryString
Constructor Detail

QueryResultItem

public QueryResultItem(java.lang.String queryString)
Method Detail

getItemNumber

public int getItemNumber()
Returns:
the item-number of this QueryResultItem (in the list of QueryResultItems held by a QueryResultSet)

setItemNumber

public void setItemNumber(int itemNumber)
Should only be used internally by the GDS Java API

See Also:
getItemNumber()

getSchema

public java.lang.String getSchema()
See http://desktop.google.com/queryapi.html#individualresult

Specified by:
getSchema in interface IJGDResultItem

setSchema

public void setSchema(java.lang.String schema)
See http://desktop.google.com/queryapi.html#individualresult


getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()
See http://desktop.google.com/queryapi.html#individualresult


setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
See http://desktop.google.com/queryapi.html#individualresult


getURI

public java.lang.String getURI()
See http://desktop.google.com/queryapi.html#individualresult


calculateSnippet

protected void calculateSnippet()
It seems that the current Native GD API does not support obtaining a summary/snippet of a search-result -entry (the documentation on http://desktop.google.com/queryapi.html#individualresult mentions a summary -property, but this property is not listed in the complete set of properties)

Parameters:
textContentVariant - The text_content -property as a Variant
queryString - the query-string used which resulted in a QueryResultItem having the given text_content

setSnippet

public void setSnippet(java.lang.String snippet)
Description copied from interface: ResultsType.ResultType
snippet is a snippet from the result's content that contains at least one of the search terms.

Specified by:
setSnippet in interface ResultsType.ResultType
Parameters:
snippet - allowed object is String
See Also:
jgd.comapi.QueryCOM#getSnippet(Variant, QueryString)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this QueryResultItem -object

getCacheUrl

public java.lang.String getCacheUrl()
Description copied from interface: ResultsType.ResultType
cache_url is the Google Desktop Search-relative URL of this result's internal cache page.

Specified by:
getCacheUrl in interface ResultsType.ResultType
Returns:
possible object is String

getCategory

public java.lang.String getCategory()
Description copied from interface: ResultsType.ResultType
contains the result's type, one of: email, chat, web, file, contact, calendar, task, journal, note.

Specified by:
getCategory in interface ResultsType.ResultType
Returns:
possible object is String

getDocId

public long getDocId()
Description copied from interface: ResultsType.ResultType
doc_id is the result's GDS internal identifier for doc. (Only for Desktop2)

Specified by:
getDocId in interface ResultsType.ResultType

getEventId

public long getEventId()
Description copied from interface: ResultsType.ResultType
event_id is the result's GDS internal identifier for event. (Only for Desktop2)

Specified by:
getEventId in interface ResultsType.ResultType

getFlags

public java.lang.String getFlags()
Description copied from interface: ResultsType.ResultType
Undocumented by google (Only for Desktop2)

Specified by:
getFlags in interface ResultsType.ResultType
Returns:
possible object is String

getFrom

public java.lang.String getFrom()
Description copied from interface: ResultsType.ResultType
from is the name of either the person an email message was from, or the other party in a Instant Message chat.

Specified by:
getFrom in interface ResultsType.ResultType
Returns:
possible object is String

getIcon

public java.lang.String getIcon()
Deprecated. 

Description copied from interface: ResultsType.ResultType
icon is a Google Desktop Search-relative URL to an icon representing this result or its type. This will either be one of the standard Google Desktop Search result type icons (envelope for email, Word icon for a Word file, etc.) or a favicon obtained from a website.

Specified by:
getIcon in interface ResultsType.ResultType
Returns:
possible object is String

getId

public long getId()
Description copied from interface: ResultsType.ResultType
id is the result's GDS internal identifier.

Specified by:
getId in interface ResultsType.ResultType

getMessageId

public java.lang.String getMessageId()
Description copied from interface: ResultsType.ResultType
Undocumented by google (Only for Desktop2)

Specified by:
getMessageId in interface ResultsType.ResultType
Returns:
possible object is String

getThumbnail

public java.lang.String getThumbnail()
Description copied from interface: ResultsType.ResultType
thumbnail is a relative URL to the icon for this result at the GDS webserver

Specified by:
getThumbnail in interface ResultsType.ResultType
Returns:
possible object is String

getTime

public java.math.BigInteger getTime()
Description copied from interface: ResultsType.ResultType
time is the time value from the event that put this content into GDS. Usually this will be the time the content was indexed by GDS, but, for example, it could also be a file's last modified time. The format is per the Windows FILETIME structure; the number of 100-nanosecond intervals since January 1, 1601 represented as a 64-bit number.

Specified by:
getTime in interface ResultsType.ResultType
Returns:
possible object is BigInteger

getProperty

public java.lang.Object getProperty(java.lang.String name)

getTitle

public java.lang.String getTitle()
Description copied from interface: ResultsType.ResultType
title is the result's title, which varies depending on its type: Web page: the page's title. Email: the message's Subject:. File: its filename. Chat: a line from the chat.

Specified by:
getTitle in interface ResultsType.ResultType
Returns:
possible object is String

getUrl

public java.lang.String getUrl()
Description copied from interface: ResultsType.ResultType
url is the result's URL. For files and web pages, this is the usual path to the result. For chats and email messages, Google Desktop Search generates a URL for the location where it has stored its cached copy.

Specified by:
getUrl in interface ResultsType.ResultType
Returns:
possible object is String

setCacheUrl

public void setCacheUrl(java.lang.String value)
Description copied from interface: ResultsType.ResultType
cache_url is the Google Desktop Search-relative URL of this result's internal cache page.

Specified by:
setCacheUrl in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setCategory

public void setCategory(java.lang.String value)
Description copied from interface: ResultsType.ResultType
contains the result's type, one of: email, chat, web, file, contact, calendar, task, journal, note.

Specified by:
setCategory in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setDocId

public void setDocId(long value)
Description copied from interface: ResultsType.ResultType
doc_id is the result's GDS internal identifier for doc. (Only for Desktop2)

Specified by:
setDocId in interface ResultsType.ResultType

setEventId

public void setEventId(long value)
Description copied from interface: ResultsType.ResultType
event_id is the result's GDS internal identifier for event. (Only for Desktop2)

Specified by:
setEventId in interface ResultsType.ResultType

setFlags

public void setFlags(java.lang.String value)
Description copied from interface: ResultsType.ResultType
Undocumented by google (Only for Desktop2)

Specified by:
setFlags in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setFrom

public void setFrom(java.lang.String value)
Description copied from interface: ResultsType.ResultType
from is the name of either the person an email message was from, or the other party in a Instant Message chat.

Specified by:
setFrom in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setIcon

public void setIcon(java.lang.String value)
Description copied from interface: ResultsType.ResultType
icon is a Google Desktop Search-relative URL to an icon representing this result or its type. This will either be one of the standard Google Desktop Search result type icons (envelope for email, Word icon for a Word file, etc.) or a favicon obtained from a website.

Specified by:
setIcon in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setId

public void setId(long value)
Description copied from interface: ResultsType.ResultType
id is the result's GDS internal identifier.

Specified by:
setId in interface ResultsType.ResultType

setMessageId

public void setMessageId(java.lang.String value)
Description copied from interface: ResultsType.ResultType
Undocumented by google (Only for Desktop2)

Specified by:
setMessageId in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setThumbnail

public void setThumbnail(java.lang.String value)
Description copied from interface: ResultsType.ResultType
thumbnail is a relative URL to the icon for this result at the GDS webserver

Specified by:
setThumbnail in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setTime

public void setTime(java.math.BigInteger value)
Description copied from interface: ResultsType.ResultType
time is the time value from the event that put this content into GDS. Usually this will be the time the content was indexed by GDS, but, for example, it could also be a file's last modified time. The format is per the Windows FILETIME structure; the number of 100-nanosecond intervals since January 1, 1601 represented as a 64-bit number.

Specified by:
setTime in interface ResultsType.ResultType
Parameters:
value - allowed object is BigInteger

setTitle

public void setTitle(java.lang.String value)
Description copied from interface: ResultsType.ResultType
title is the result's title, which varies depending on its type: Web page: the page's title. Email: the message's Subject:. File: its filename. Chat: a line from the chat.

Specified by:
setTitle in interface ResultsType.ResultType
Parameters:
value - allowed object is String

setUrl

public void setUrl(java.lang.String value)
Description copied from interface: ResultsType.ResultType
url is the result's URL. For files and web pages, this is the usual path to the result. For chats and email messages, Google Desktop Search generates a URL for the location where it has stored its cached copy.

Specified by:
setUrl in interface ResultsType.ResultType
Parameters:
value - allowed object is String

getTimestamp

public java.util.Date getTimestamp()
Specified by:
getTimestamp in interface IJGDResultItem

getFormat

public int getFormat()

getTextContent

public java.lang.String getTextContent()

getSnippet

public java.lang.String getSnippet()
Description copied from interface: ResultsType.ResultType
snippet is a snippet from the result's content that contains at least one of the search terms.

Specified by:
getSnippet in interface ResultsType.ResultType
Returns:
possible object is String


Copyright © 2007