Closed clinm closed 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 !
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
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.
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 :
Examples :
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