lawwenda.search package

Module contents

File search functionality.

Used by the Lawwenda user interface’s ‘Search’ feature.

class lawwenda.search.ByGeoSearch(position, *, radius)

Bases: lawwenda.search.Search

Searches for files that are associated with a particular geographic region.

See also lawwenda.fs.Filesystem.Node.geo.

Parameters
  • position (str) –

  • radius (Union[str, float]) –

__decide(node)
Parameters

node (FilesystemNode) –

Return type

bool

query(node)

Return a list of nodes that match the criteria of this search, starting from a given root node.

Parameters

node – The root node. Query result nodes are usually inside that subtree.

class lawwenda.search.ByNameSearch(term)

Bases: lawwenda.search.Search

Searches for search terms in file names.

See also lawwenda.fs.Filesystem.Node.name.

Parameters

term (str) –

__decide(node)
Parameters

node (FilesystemNode) –

Return type

bool

query(node)

Return a list of nodes that match the criteria of this search, starting from a given root node.

Parameters

node – The root node. Query result nodes are usually inside that subtree.

class lawwenda.search.ByTagSearch(term)

Bases: lawwenda.search.Search

Searches for files that have particular tags.

See also lawwenda.fs.Filesystem.Node.tags.

Parameters

term (str) –

__decide(node)
Parameters

node (FilesystemNode) –

Return type

bool

query(node)

Return a list of nodes that match the criteria of this search, starting from a given root node.

Parameters

node – The root node. Query result nodes are usually inside that subtree.

class lawwenda.search.DeeplySearch(term)

Bases: lawwenda.search.Search

Deep searches look for search terms in some places, like file names or comments, but also in fulltext indexes or - as a fallback - directly in the content of each file.

This is a rather versatile search behavior, but is not precisely defined, and can be impractically slow if not fulltext index is available.

Parameters

term (str) –

__decide_unindexed(node)
Parameters

node (FilesystemNode) –

Return type

bool

__decide_unindexed_by_content(node)
Parameters

node (FilesystemNode) –

Return type

bool

__decide_unindexed_by_metadata(node)
Parameters

node (FilesystemNode) –

Return type

bool

__query_indexed(idxdata)
Parameters
  • node (FilesystemNode) –

  • idxdata (object) –

Return type

FilesystemNodes

__query_unindexed(node)
Parameters

node (FilesystemNode) –

Return type

FilesystemNodes

__try_get_index(node)
Parameters

node (FilesystemNode) –

Return type

object

query(node)

Return a list of nodes that match the criteria of this search, starting from a given root node.

Parameters

node – The root node. Query result nodes are usually inside that subtree.

class lawwenda.search.Search

Bases: object

Base class for different search behaviors.

query(node)

Return a list of nodes that match the criteria of this search, starting from a given root node.

Parameters

node (FilesystemNode) – The root node. Query result nodes are usually inside that subtree.

Return type

FilesystemNodes

lawwenda.search._query_by_tree_traversal(node, decidefct)
Parameters
  • node (FilesystemNode) –

  • decidefct (Callable[[FilesystemNode], bool]) –

Return type

FilesystemNodes

lawwenda.search._termstring_to_termlist(term)
Parameters

term (str) –

Return type

List[str]

Return a Search object with a particular configuration.

Parameters
  • mode (str) – The search mode string.

  • kwargs – Additional search arguments, specific to the chosen mode.

Return type

lawwenda.search.Search