Jeanselme / Search_Engine

A search engine through different types of document.
GNU General Public License v3.0
0 stars 0 forks source link

Arguments needed to make a research #6

Closed clinm closed 7 years ago

clinm commented 7 years ago

I would like to discuss the basic structure for the arguments of the search engine. From my point of view, we have two distinct functionalities :

The first idea that came to my mind to organize this is :

The research and index keyword can specify which functionality we want.

On the same principle, I think we could do the same for the index entry like following :

   python Search.py research <document_type> <query>

Examples :

   python Search.py research text "Alice"
   python Search.py research image ./path/to/my/image

I think this architecture would give us enough freedom to add as many endpoints as we want and should be pretty straightforward to implement using argparse

Jeanselme commented 7 years ago

I agree on the two functionalities, however I would prefer to not have to specify the document_type, the factory has to do the association.

Nevertheless, it should be possible to limit the research to a certain kind of documents. I would have seen something like that :

python3.5 SearchEngine.py research [-text|-image] query

The factory should test whether the query is a valid pass or if it has to be interpreted as text, if an option is specified, it would do like you proposed.

Moreover, I think an option is also needed for indexation,

python3.5 SearchEngine.py indexation [-force] document*

Finally, It is a good idea to use argparse, that seems to avoid a lot of issues !

clinm commented 7 years ago

Assuming that we have a parameter for each kind of document we are handling. Are we taking into account all kind of composition between them ? I mean something like

  python3.5 SearchEngine.py research -text -image query

Then the arguments should look like that :

  python3.5 SearchEngine.py research [-text] [-image]
  #instead of
  python3.5 SearchEngine.py research [-text|-image]

If we want to accelerate the command line (the type we take to type it), we should consider two different python scripts then :

Then the normal use (and thus the most common command line) would be :

   python3.5 SearchEngine.py query
Jeanselme commented 7 years ago

It is perhaps the best idea to separate, that would make the parser easier. And the different actions will be perfectly separated. Moreover, it is rare that a simple user do the indexation and will just use the search. So I am okay with last proposition, moreover, you have right : it is a non exclusive or for the option of the research.