RB.SourceSearch

g GObject.Object GObject.Object RB.SourceSearch RB.SourceSearch GObject.Object->RB.SourceSearch

Subclasses:

RB.SourceSearchBasic

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

add_to_menu (menu, action_namespace, action, name)

class

get_by_name (name)

create_query (db, search_text)

get_description ()

is_subset (current, next)

register (name)

Virtual Methods

Inherited:

GObject.Object (7)

do_create_query (db, search_text)

do_get_description ()

do_is_subset (current, next)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class RB.SourceSearch(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

RB.SourceSearchClass

These translate the text in the search entry box into a RhythmDBQuery. The basic implementation will return a query like RB.RhythmDBQueryType.FUZZY_MATCH, RB.RhythmDBPropType.SEARCH_MATCH, text. Simple variants can restrict the search to single properties (artist, album, genre). More complicated searches could implement something like the Xesam User Query spec.

The source header finds the search instance to use by looking for the ‘rb-source-search’ data item on the active search action.

classmethod add_to_menu(menu, action_namespace, action, name)
Parameters:
  • menu (Gio.Menu) – Gio.Menu instance to populate

  • action_namespace (str) – muxer namespace for the action (“app” or “win”)

  • action (Gio.Action) – search action to attach the menu item to

  • name (str) – name of the search instance to add

Adds a registered search instance to a search menu.

classmethod get_by_name(name)
Parameters:

name (str) – name to look up

Returns:

search instance, or None if not found

Return type:

RB.SourceSearch

Finds the registered search instance with the specified name

create_query(db, search_text)
Parameters:
Returns:

#RhythmDBQuery for the source to use

Return type:

GLib.PtrArray

Creates a #RhythmDBQuery from the user’s search text.

get_description()
Returns:

description string

Return type:

str

Returns a description of the search suitable for displaying in a menu

is_subset(current, next)
Parameters:
  • current (str) – the current search text (or None if the current search was done with a different search implementation and so cannot be considered)

  • next (str) – the new search text

Returns:

True iff the new search text will match a subset of those matched by the current search.

Return type:

bool

Determines whether the new search text will result in a subset of entries matched by the previous search. This is used to optimise the search query.

register(name)
Parameters:

name (str) – name to register

Registers a named search instance that can be used in menus and search action states.

do_create_query(db, search_text) virtual
Parameters:
Returns:

#RhythmDBQuery for the source to use

Return type:

GLib.PtrArray

Creates a #RhythmDBQuery from the user’s search text.

do_get_description() virtual
Returns:

description string

Return type:

str

Returns a description of the search suitable for displaying in a menu

do_is_subset(current, next) virtual
Parameters:
  • current (str) – the current search text (or None if the current search was done with a different search implementation and so cannot be considered)

  • next (str) – the new search text

Returns:

True iff the new search text will match a subset of those matched by the current search.

Return type:

bool

Determines whether the new search text will result in a subset of entries matched by the previous search. This is used to optimise the search query.