pg_search

https://github.com/casecommons/pg_search

Ruby

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search

Gitlab::GroupHierarchy#all_groups

Returns a relation that includes the base groups, their ancestors,
and the descendants of the base groups.

The resulting query will roughly look like the following:

    WITH RECURSIVE ancestors AS ( ... ),
      descendants AS ( ... )
    SELECT *
    FROM (
      SELECT *
      FROM ancestors namespaces

      UNION

      SELECT *
      FROM descendants namespaces
    ) groups;

Using this approach allows us to further add criteria to the relation with
Rails thinking it's selecting data the usual way.

If nested groups are not supported, ancestors_base is returned.

Source | Google | Stack overflow

Edit

git clone [email protected]:casecommons/pg_search.git

cd pg_search

open

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Gitlab--GroupHierarchy-all_groups-for-pr


# Commit to git

git add git commit -m "better docs for Gitlab::GroupHierarchy#all_groups"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Gitlab--GroupHierarchy-all_groups-for-pr

hub pull-request


# Celebrate!