[1.0.x] Semantic Search - AI Vectored Search

Created on 4 September 2023, 10 months ago
Updated 30 September 2023, 9 months ago

The aim of this module is to integrate with various AI libraries to leverage AI-powered search functionalities.

Project link

https://www.drupal.org/project/semantic_search →

📌 Task
Status

Fixed

Component

module

Created by

🇫🇷France becassin Lyon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @becassin
  • 🇮🇳India vishal.kadam Mumbai

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect → for more details and Security advisory coverage application checklist → to understand what reviewers look for. Tips for ensuring a smooth review → gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications → , Application workflow → , What to cover in an application review → , and Tools to use for reviews → .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool → only once per application.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues → .

  • 🇮🇳India vishal.kadam Mumbai
  • 🇮🇳India vishal.kadam Mumbai

    Remember to change the status to Needs review when the project is ready for review.

  • Status changed to Needs review 10 months ago
  • 🇫🇷France becassin Lyon

    Thanks for helping !

    I've fixed the phpcs issues.

  • Status changed to Needs work 10 months ago
  • 🇮🇳India vishal.kadam Mumbai

    1. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml semantic_search/
    
    FILE: semantic_search/semantic_search.routing.yml
    --------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------
     15 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than
        |         | "access administration pages" which is about viewing but not changing configurations.
     25 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than
        |         | "access administration pages" which is about viewing but not changing configurations.
     35 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than
        |         | "access administration pages" which is about viewing but not changing configurations.
    --------------------------------------------------------------------------
    
    
    FILE: semantic_search/src/Form/SearchForm.php
    --------------------------------------------------------------------------
    FOUND 1 ERROR AND 6 WARNINGS AFFECTING 7 LINES
    --------------------------------------------------------------------------
       8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Algenza\Cosinesimilarity\Cosine.
      76 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
      78 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
      83 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
      86 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     162 | WARNING | [ ] Node::loadMultiple calls should be avoided in classes, use dependency injection instead
     165 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------
    
    
    FILE: semantic_search/src/Form/DeleteConfirmForm.php
    --------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------
      7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
     81 | WARNING | [ ] Unused variable $result.
    --------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------
    
    
    FILE: semantic_search/src/Form/IndexingForm.php
    --------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------
      36 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      67 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
      74 | WARNING | Node::loadMultiple calls should be avoided in classes, use dependency injection instead
     106 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     107 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------
    
    
    FILE: semantic_search/src/Form/SettingsForm.php
    --------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------
     200 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------
    
    
    FILE: semantic_search/src/Services/EmbeddingStorageService.php
    --------------------------------------------------------------------------
    FOUND 1 ERROR AND 4 WARNINGS AFFECTING 5 LINES
    --------------------------------------------------------------------------
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Database\Connection.
     103 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     105 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     107 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
     114 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------
    
    
    FILE: semantic_search/src/Services/EmbeddingVectorizationService.php
    --------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------
     53 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     70 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------

    2. FILE: semantic_search.info.yml

    core_version_requirement: ^8 || ^9 || ^10

    The Drupal Core versions before 8.7.7 do not recognize the core_version_requirement: key.

    package: Custom

    Modules should avoid using that value for the package.

  • Status changed to Needs review 10 months ago
  • 🇫🇷France becassin Lyon

    Right, I had forgotten to run the DrupalPractice standard. It's fixed now.

  • 🇮🇳India vishal.kadam Mumbai

    Rest looks fine to me.

    Let’s wait for other reviewers to take a look and if everything goes fine, you will get the role.

  • Status changed to RTBC 10 months ago
  • 🇮🇳India vinaymahale

    No issues found
    Changing status to RTBC!

  • Status changed to Needs work 10 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    • What follows is a quick review of the project; it doesn't mean to be complete
    • For each point, the review usually shows some lines that should be fixed (except in the case the point is about the full content of a file); it doesn't show all the lines that need to be changed for the same reason
    • A review is about code that doesn't follow the coding standards, contains possible security issue, or doesn't correctly use the Drupal API; the single points aren't ordered, not even by importance

    src/Form/DeleteConfirmForm.php

      public static function create(ContainerInterface $container) {
        $instance = parent::create($container);
        $instance->database = $container->get('database');
        $instance->client = $container->get('semantic_search.pinecone_client');
        return $instance;
      }
    

    create() calls the class constructor passing the dependencies. It does not call the same method in the parent class to then initialize the object properties.

    switch (\Drupal::config('semantic_search.settings')->get('embedding_storage')) {

    Each dependency is injected via the create() method.

          // @todo Postgres.
          case EmbeddingStorageService::POSTGRES_STORAGE_KEY:
            break;
        }
    

    Code used for these applications must be complete. There should not be any @todo like that.

    src/Services/EmbeddingVectorizationService.php

      public static function getVectorizationService() {
        $vectorization_service = \Drupal::config('semantic_search.settings')->get('embedding_vectorization');
        return $vectorization_service;
      }
    

    The configuration factory has been injected. That code needs to be changed, especially because it is called from another method of the same class that is not static.

    case EmbeddingVectorizationService::OPENAI_KEY:

    Since that is code in the EmbeddingVectorizationService class, it needs to use self.

  • Status changed to RTBC 9 months ago
  • 🇫🇷France becassin Lyon

    Thanks vinaymahale & apaderno,

    I've fixed the issues from your comment, plus all those similar.

  • Status changed to Needs review 9 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Thank you for your contribution! I am going to update your account.

    These are some recommended readings to help with excellent maintainership:

    You can find more contributors chatting on the Slack → #contribute channel. So, come hang out and stay involved → .
    Thank you, also, for your patience with the review process.
    Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review → . I encourage you to learn more about that process and join the group of reviewers.

    I thank all the reviewers.

  • Assigned to apaderno
  • Status changed to Fixed 9 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024