Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-3610

Search 6 groundwork - Rename Search.getSearchSession(Session) to Search.session(Session)

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 6.0.0.Alpha7
    • Components: mapper-orm
    • Labels:
      None

      Description

      This:

      SearchResult<Book> result = Search.getSearchSession(em).search(Book.class)
              .predicate(f -> f.matchAll())
              .fetch(20, 0);
      

      will become this:

      SearchResult<Book> result = Search.session(em).search(Book.class)
              .predicate(f -> f.matchAll())
              .fetch(20, 0);
      

      ... which is shorter but also will allow, one day, to have extra methods in Search such as this:

      MassIndexer massIndexer = Search.massIndexer(entityManagerFactory, Book.class);
      MassIndexer massIndexer = Search.massIndexer(entityManagerFactory, tenantId, Book.class);
      MassIndexer massIndexer = Search.massIndexer(entityManagerFactory, tenantId, Book.class, Author.class);
      
      // For session-less operations such as purge... maybe?
      SearchWriter writer = Search.writer(entityManagerFactory, Book.class);
      SearchWriter writer = Search.writer(entityManagerFactory, tenantId, Book.class);
      SearchWriter writer = Search.writer(entityManagerFactory, tenantId, Book.class, Author.class);
      

      Keep Search.getSearchSession() for now, but implement it as a redirection to Search.session(), and deprecate it.

      Be sure to replace every use of Search.getSearchSession() in our code with the new syntax.

        Attachments

          Activity

            People

            • Assignee:
              yrodiere Yoann Rodière
              Reporter:
              yrodiere Yoann Rodière
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: