-5

I want to develop a software center in Ubuntu. In ubuntu software center, when we type a keyword and hits enter button, it displays us the related results. For example, when i searched for "eclipse" keyword, 5 result are listed in ubuntu software center.

I want to do the similar functionality in my software center.

I tried to solve this problem by making search in apt package manager using bash command(apt search package_name), but it gives all packages as result, approximately more than 100 packages.

How ubuntu software center and other software centers search a keyword? Where do they search the keyword and retrieve results? Source code of ubuntu software center is so complex and i cannot find what i need. Any guide will be appreciated.

EDIT

I analysed all source code of ubuntu software center. These codes includes so many technologies that it is very hard to understand it. IN order to understand these codes, i have to learn many technologies , it may take at least one month,maybe this time may not be enough. After i spent so many times learning these technologies, what if these technologies does not solve my problem? I know only python, i am not familiar with os library etc, and i have a limited time, please guide me. I need to build a simple software center, not a sophisticated one.

Thanks in advance.

metis
  • 1,024
  • 2
  • 10
  • 26

1 Answers1

2

It is open-source and it might even use Python.

To find out what package installs Software Center:

$ apt-file find -F /usr/bin/software-center
software-center: /usr/bin/software-center

To download the source code:

$ mkdir software-center
$ cd software-center/
$ apt-get source software-center

Look for the word 'search' in the source code. utils/search_query.py seems relevant. It looks like it uses xapian module to do the actual work. It queries /var/lib/apt-xapian-index/index xapian database among others.

jfs
  • 399,953
  • 195
  • 994
  • 1,670
  • i didn't understand what you mean by saying : "To find out what package installs Software Center:". I installed apt-file. then i found the file /usr/bin/software-center . I opened this file but i didn't understand the purpose of this file. What is the purpose of this file? What is happening in this file? – metis Mar 11 '15 at 13:50
  • @metis: the purpose of this file is to give you the name of the package. To answer the second question: the only reason you need the name of the package here is to find its source code. If you already have "Software Center"'s source code; ignore that part of the answer. – jfs Mar 11 '15 at 13:56
  • I analysed the files you mentioned, I analysed all source code. These codes includes so many technologies that it is very hard to understand it. IN order to understand these codes, i have to learn many technologies , it may take at least one month,maybe this time may not be enough. After i spent so many times learning these technologies, what if these technologies does not solve my problem? I know only python, i am not familiar with os library etc, and i have a limited time, please guide me. I need to build a simple software center, not a sophisticated one. I appreciate your helps greatly. – metis Mar 11 '15 at 23:04
  • @metis: *"what if these technologies does not solve my problem?"* --- libraries that are used to implement one software center (ubuntu) may be used to implement another (yours) if you want to duplicate its functions. Obviously, you can use completly different libraries. In any case, to implement an application you either need to learn how to use existing software that it may consist of or implement the parts yourself. If you don't have time to learn how to use existing tools; it is unlikely that you have time to implement them yourself. Narrow your requirements. – jfs Mar 12 '15 at 00:17