@StableMinor(version="7.1", sinceVersion="4.0") public abstract class SearchHit extends Object
SearchResults
object.
It represents an indexed information that match a query
that was
executed
.
A SearchHit object returns some of the predefined fields (Title, Subtitle, URL) of the original indexed information, and the following additional fields:
Modifier and Type | Field and Description |
---|---|
protected SearchAttributes |
attributes |
protected float |
rank |
protected String |
snippet |
protected String |
subtitle |
protected String |
title |
protected String |
url |
Constructor and Description |
---|
SearchHit()
Constructs an instance with null URL, title and subtitle
predefined fields.
|
SearchHit(String url,
String title,
String subtitle)
Constructs an instance with the given URL, title and subtitle
predefined fields.
|
Modifier and Type | Method and Description |
---|---|
SearchAttributes |
getAttributes()
Returns the hit's
attributes . |
String |
getParentId()
Returns the identifier of the parent of this hit.
|
float |
getRank()
Returns the rank value.
|
SearchContent |
getSearchContent()
Returns a
SearchContent object related to the hit, containing all
fields . |
String |
getSnippet()
Returns the snippet value.
|
String |
getSubtitle()
Returns the subtitle field
value.
|
String |
getTitle()
Returns the title field value.
|
String |
getUrl()
Returns the URL field value.
|
void |
setParentId(String parentId)
Sets the parent identifier of this hit.
|
void |
setRank(float rank)
Sets the rank value.
|
void |
setSnippet(String snippet)
Sets the the snippet value.
|
void |
setSubtitle(String subtitle)
Sets the subtitle field value.
|
void |
setTitle(String title)
Sets the title field value.
|
void |
setUrl(String url)
Sets the URL field value.
|
protected String url
protected String title
protected String subtitle
protected String snippet
protected float rank
protected SearchAttributes attributes
public SearchHit()
SearchContentField.FIELDNAME_URL
,
SearchContentField.FIELDNAME_TITLE
,
SearchContentField.FIELDNAME_SUBTITLE
public SearchHit(String url, String title, String subtitle)
url
- URL field valuetitle
- title fieldsubtitle
- subtitle fieldSearchContentField.FIELDNAME_URL
,
SearchContentField.FIELDNAME_TITLE
,
SearchContentField.FIELDNAME_SUBTITLE
public String getUrl()
SearchContentField.FIELDNAME_URL
public void setUrl(String url)
url
- URL field valueSearchContentField.FIELDNAME_URL
public String getTitle()
SearchContentField.FIELDNAME_TITLE
public void setTitle(String title)
title
- title field valueSearchContentField.FIELDNAME_TITLE
public String getSubtitle()
SearchContentField.FIELDNAME_SUBTITLE
public void setSubtitle(String subtitle)
subtitle
- subtitle field valueSearchContentField.FIELDNAME_SUBTITLE
public void setRank(float rank)
rank
- rank valuepublic String getSnippet()
public void setSnippet(String snippet)
snippet
- snippet valuepublic String getParentId()
SearchContent
is indexed, the indexer may divide it into
multiple entries. In this case a primary one should be set as the parent
of the others.null
if this is a primary hit.public void setParentId(String parentId)
parentId
- the parent identifier to set.getParentId()
public SearchAttributes getAttributes()
attributes
.
Attributes contain additional information returned by the
search engine in a query
execution
.
attributes
public SearchContent getSearchContent() throws UnsupportedOperationException
SearchContent
object related to the hit, containing all
fields
.
Implementations that do not support this opperation will throw an
UnsupportedOperationException
.
SearchContent
object related to the hit.UnsupportedOperationException
Lumisportal 7.1.1.140331 - Copyright © 2006–2014 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.