You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Prerequisites

Ask For Access And Branch Folder

Before start working, ask permission to access and clone the project Search API

https://source.digital.accenture.com/projects/ST/repos/search-api/browse

And the creation of a branch folder specific for your project, where you and your team will have complete freedom to create more branches, add, update and delete code.

your-project/develop
your-project/main
your-project/features
your-project/release
Why have a branch folder, in the same repository and not have my own repository? The branch folder is recommended to make synergy between the different project under development at the same time, features created on a project, may as well be used in another, all generic features are merge into the root develop branch, and from there can be distributed to other projects and user in future projects.

You still can have the code in another repository, but in that case we still recommend have the branch folder and synchronize changes, making the support of the project less invasive and the upgrade of the code, more fluid

Download Python 

Download and install Python, currently version 3.11.2, except for Windows which currently can manage 3.9.X due to a C compilation issue with a dependency


The new backend of the Enterprise Search is built in Python, using Fast API, which allow us to maintain a structure like ExpressJs, but with a better understanding and on-the-fly documentation with Swagger UI and Redoc

You can see more about the features of Fast API here


Disable the path length limit to prevent issues in windows environment

Fahim-article-image



Setup Environment

Clone and Set The Branch

Connection to Accenture's VPN is required

  1. Clone the project from the repository

    git clone https://source.digital.accenture.com/scm/st/search-api.git
  2. Verify the current brach executing the command below, it should be main

    git branch
    1. If the branch wasn't main, checkout the main branch:

      git checkout main
  3. Create a branch to work on, using the branch folder assigned <branch_folder>/develop (we recommend using develop as your working branch)

    git checkout -b <branch_folder>/develop

Create & Use A Virtual Environment

We recommend the creation of a virtual environment to prevent python dependencies conflicts, is also helpful if you have multiple versions of python in the same machine

python -m venv {name_of_your_venv}


 or

python3 -m venv {name_of_your_venv}


If you want to name you virtual environment test then the command would look like this

python -m venv test


 or

python3 -m venv test

Activate Virtual Environment

To use your virtual environment you need to activated, the activation command changes depending on your OS

  • For Windows

    {name_of_your_venv}\Scripts\activate.bat
  • For Unix or macOS, run:

    source {name_of_your_venv}/bin/activate

    If using a bash console on Windows, then you have to execute

    source {name_of_your_venv}/Scripts/activate

Following the example of the venv named test, the commands would look like this:

  • Windows

    test\Scripts\activate.bat
  • Unix or macOS:

    source test/bin/activate

Install Python Dependencies

If you are working on Windows you may need to download Build Tools for Visual Studio and install the Universal Windows Platform build tools (Probably will require Admin rights). Unix bases OS should have any issues

Once the virtual environment is activates (if you did one, otherwise is the same process), install the dependencies stored in the pyproject.toml. To install them execute the following command:

pip install -e .

If that didn't work try

python -m pip install -e .


 or

python3 -m pip install -e .

If you have installed new python dependencies, you may to update the pyproject.toml, with the latest changes{

Install with Development Dependencies

Same as above, but additionally it will install development dependencies necessary for testing a server mocking

pip install -e '.[test]'

Install PyQPL local library

After the installation is successful, proceed to install PyQPL

pip install lib/pyqpl-VERSION_IN_PROJECT-py3-none-any.whl

 Is better is you write lib/pyqpl and then let the autocomplete of the terminal write the rest of the file

Why Use PyQPL?

PyQPL is our proprietary dependency, is a versatile scripting language that simplifies the construction of complex queries. It offers engine agnosticism, query parsing, manual query building, query translation, Saga coupling for advanced processing, synonym expansion, and support for custom operators. With PyQPL, you can write standardized queries irrespective of the underlying search engine, making it flexible and efficient for query processing tasks.

Is already seamlessly integrated into the Query Stage, and can be enable or disabled as need it, probably if you are working or had work with Search API previously, have used PyQPL without notice.

If any issue raises or a feature is required please don't hesitate to contact the development team

Uninstall PyQPL local library

In case you need to upgrade the version of pyqpl, we recommend to uninstall the current library using the command

pip uninstall pyqpl

Delete the whl file and replace it with the new one, and use the same command as above to install the new one


Startup The Server

In order to startup the server the Non-SQL engine needs to be up and running, and the connection to it must setup in the Configuration


In root folder execute

python uvicorn_server.py 


 or

python3 uvicorn_server.py
  • No labels