![]() |
![]() |
![]() |
hud-service Hacking Guide | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
HudResultHudResult — a search result: a HudItem plus metadata about why it matched |
HudResult; guint hud_result_get_distance (HudResult *result
,guint max_usage
); const gchar * hud_result_get_html_description (HudResult *result
); HudResult * hud_result_get_if_matched (HudItem *item
,HudTokenList *search_tokens
,guint penalty
); HudItem * hud_result_get_item (HudResult *result
); HudResult * hud_result_new (HudItem *item
,HudTokenList *search_tokens
,guint penalty
);
A HudResult is a wrapper around a HudItem plus information about why (and how closely) it matched a particular search.
guint hud_result_get_distance (HudResult *result
,guint max_usage
);
Returns the "adjusted" distance of result
.
If max_usage
is zero then the returned value is equal to the
distance between the HudItem used to create the result and the
search string.
If max_usage
is non-zero then it is taken to be the usage count of
the most-used item in the same query as this result. The distance is
adjusted for this fact to penalise less-frequently-used item.
|
a HudResult |
|
the maximum usage count we consider |
Returns : |
the adjusted distance |
const gchar * hud_result_get_html_description (HudResult *result
);
Returns a textual description of result
with the parts of the text
that matched the search string strenghtened (ie: in bold).
|
a HudResult |
Returns : |
the description |
HudResult * hud_result_get_if_matched (HudItem *item
,HudTokenList *search_tokens
,guint penalty
);
Creates a HudResult for item
, only if the resulting unadjusted
distance would be less than or equal to the maximum distance
specified in the HUD settings.
This is the same as hud_result_new()
except that it will return NULL
if the distance is too great.
The penalty value is ignored when checking the maximum distance but will impact the distance of the created result. As a result, the returned HudResult may have an effective distance greater than the maximum distance.
HudItem * hud_result_get_item (HudResult *result
);
Gets the HudItem for result
.
HudResult * hud_result_new (HudItem *item
,HudTokenList *search_tokens
,guint penalty
);
Creates a HudResult for item
as search for using search_string
.
If penalty
is non-zero then it is used to increase the distance of
the result. This is used to decrease the ranking of matches from the
indicators.