mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 02:24:16 +02:00
[improvement][aur] generating the semantic search map on demand instead of storing it in memory
This commit is contained in:
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
### Improvements
|
### Improvements
|
||||||
- UI
|
- UI
|
||||||
- treating multiple lines on the application's description displayed on the table
|
- treating multiple lines on the application's description displayed on the table
|
||||||
|
- AUR:
|
||||||
|
- generating the semantic search map on demand instead of storing it in memory
|
||||||
### Fixes
|
### Fixes
|
||||||
- Snap
|
- Snap
|
||||||
- not able to launch applications on some distros ( e.g: OpenSuse )
|
- not able to launch applications on some distros ( e.g: OpenSuse )
|
||||||
|
|||||||
@@ -47,12 +47,6 @@ SOURCE_FIELDS = ('source', 'source_x86_64')
|
|||||||
RE_PRE_DOWNLOAD_WL_PROTOCOLS = re.compile(r'^(.+::)?(https?|ftp)://.+')
|
RE_PRE_DOWNLOAD_WL_PROTOCOLS = re.compile(r'^(.+::)?(https?|ftp)://.+')
|
||||||
RE_PRE_DOWNLOAD_BL_EXT = re.compile(r'.+\.(git|gpg)$')
|
RE_PRE_DOWNLOAD_BL_EXT = re.compile(r'.+\.(git|gpg)$')
|
||||||
|
|
||||||
SEARCH_OPTIMIZED_MAP = {
|
|
||||||
'google chrome': 'google-chrome',
|
|
||||||
'chrome google': 'google-chrome',
|
|
||||||
'googlechrome': 'google-chrome'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ArchManager(SoftwareManager):
|
class ArchManager(SoftwareManager):
|
||||||
|
|
||||||
@@ -75,6 +69,11 @@ class ArchManager(SoftwareManager):
|
|||||||
self.local_config = None
|
self.local_config = None
|
||||||
self.http_client = context.http_client
|
self.http_client = context.http_client
|
||||||
|
|
||||||
|
def get_semantic_search_map(self) -> Dict[str, str]:
|
||||||
|
return {'google chrome': 'google-chrome',
|
||||||
|
'chrome google': 'google-chrome',
|
||||||
|
'googlechrome': 'google-chrome'}
|
||||||
|
|
||||||
def _upgrade_search_result(self, apidata: dict, installed_pkgs: dict, downgrade_enabled: bool, res: SearchResult, disk_loader: DiskCacheLoader):
|
def _upgrade_search_result(self, apidata: dict, installed_pkgs: dict, downgrade_enabled: bool, res: SearchResult, disk_loader: DiskCacheLoader):
|
||||||
app = self.mapper.map_api_data(apidata, installed_pkgs['not_signed'], self.categories)
|
app = self.mapper.map_api_data(apidata, installed_pkgs['not_signed'], self.categories)
|
||||||
app.downgrade_enabled = downgrade_enabled
|
app.downgrade_enabled = downgrade_enabled
|
||||||
@@ -100,7 +99,7 @@ class ArchManager(SoftwareManager):
|
|||||||
read_installed = Thread(target=lambda: installed.update(pacman.list_and_map_installed()), daemon=True)
|
read_installed = Thread(target=lambda: installed.update(pacman.list_and_map_installed()), daemon=True)
|
||||||
read_installed.start()
|
read_installed.start()
|
||||||
|
|
||||||
mapped_words = SEARCH_OPTIMIZED_MAP.get(words)
|
mapped_words = self.get_semantic_search_map().get(words)
|
||||||
|
|
||||||
api_res = self.aur_client.search(mapped_words if mapped_words else words)
|
api_res = self.aur_client.search(mapped_words if mapped_words else words)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user