Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drupal 9 support #53

Open
wants to merge 52 commits into
base: solr-7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a866166
Update src for search_api_federated_solr to 4.x
agentrickard Jan 11, 2021
08487f4
Update versions of Search API Federated Solr in composer for D8.
agentrickard Jan 11, 2021
1f5b7f5
Updates Search API Solr and dependencies.
agentrickard Jan 11, 2021
48f970a
Updates Search API Solr and dependencies for d8-domain.
agentrickard Jan 11, 2021
3ee02b2
Run composer update for d7.
agentrickard Jan 11, 2021
d2218f5
Run composer update for d7-domain.
agentrickard Jan 11, 2021
ee64b9d
Updates search index tags for vagrant build.
agentrickard Jan 11, 2021
10d1a68
Add Drupal 9.
Kbentham Jan 15, 2021
00cdfa9
Fix install / provision of solr.
agentrickard Jan 15, 2021
5e8554b
Update to Drupal 9.1
agentrickard Jan 15, 2021
2b3a724
Move the file command. Update drush.
agentrickard Jan 15, 2021
b772c15
Remove file change line that is now in the preinstall.
agentrickard Jan 15, 2021
8f5080a
Fix d9 drush alias.
Kbentham Jan 15, 2021
f6d0814
Merge branch 'drupal9' of github.com:palantirnet/federated-search-dem…
Kbentham Jan 15, 2021
d75a0ab
Add drush to d9 site.
Kbentham Jan 15, 2021
2ebb014
Add patch that allows us to install form config.
Kbentham Jan 15, 2021
02c21fd
install d9 site without config.
Kbentham Jan 15, 2021
a79d09a
Update the readme.
Kbentham Jan 15, 2021
0406933
Install d9 from the minimal profile.
agentrickard Jan 15, 2021
79b36cb
Merge branch 'drupal9' of github.com:palantirnet/federated-search-dem…
agentrickard Jan 15, 2021
0616c3c
Index Drupal 9
agentrickard Jan 15, 2021
18fab39
Updates config for D9.
agentrickard Jan 15, 2021
539b34a
Update site permissions for search.
agentrickard Jan 18, 2021
e7ee7ef
Remove search box size rule.
agentrickard Jan 18, 2021
3e20620
Composer lockfile changes.
agentrickard Jan 19, 2021
cbac579
Remove event-dispatcher 4.4 requirement.
agentrickard Jan 19, 2021
3124de1
Update composer packages.
agentrickard Jan 19, 2021
596d4f9
Update composer meta info.
agentrickard Jan 19, 2021
b22f545
Update to the new drupal-scaffold and Drupal 9.1.2
agentrickard Jan 19, 2021
aaa87fb
Update node form field settings.
agentrickard Jan 19, 2021
a81dc26
Remove old content assets from d9.
agentrickard Jan 19, 2021
9a385b1
Remove old D9 content.
agentrickard Jan 19, 2021
f234255
Updates default content for the Drupal 9 site.
agentrickard Jan 19, 2021
233edd5
Updates README.
agentrickard Jan 19, 2021
591361d
Completes the README update.
agentrickard Jan 19, 2021
9be833a
Dynamically assign dates to content in D8.
agentrickard Jan 20, 2021
ad81560
Dynamically assign dates to content in D8-domain.
agentrickard Jan 20, 2021
58e10f4
Clear cache after module uninstall during the build.
agentrickard Jan 20, 2021
32e9b6a
Dynamically assign dates to content in D9.
agentrickard Jan 20, 2021
a3d0633
Fix cache clears on the build.
agentrickard Jan 20, 2021
5ada24d
Updates README with information about date ranges.
agentrickard Jan 20, 2021
ac4ae53
Dynamically set pubdates in Drupal 7.
agentrickard Jan 20, 2021
43a1bdb
Dynamically set pubdates in Drupal 7 using the date property.
agentrickard Jan 20, 2021
de875b3
Update to Drupal 9.1.3
agentrickard Jan 20, 2021
c5cec57
Updates to Drupal 8.9.13
agentrickard Jan 20, 2021
0b0e940
Updates to Drupal 8.9.13 for d8-domain
agentrickard Jan 20, 2021
d4e2733
Updates D7 to 7.78.0
agentrickard Jan 20, 2021
ba6e606
Updates versions in README.
agentrickard Jan 20, 2021
63bf0eb
Updates D7-domain to 7.78.0
agentrickard Jan 20, 2021
d7fe1ad
Make sure we use the 7.x-3.x branch of federated solr.
agentrickard Jan 20, 2021
881e3c3
Install drush directly in the d8 folders.
agentrickard Jan 20, 2021
612fb20
Fix for vagrant failures.
agentrickard Jul 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ web/d8*/docroot/core
web/d8*/docroot/modules/contrib
web/d8*/docroot/themes/contrib/
web/d8*/docroot/profiles/contrib/
web/d9*/.editorconfig
web/d9*/.gitattributes
web/d9*/docroot/*.txt
web/d9*/docroot/*/.gitignore
web/d9*/docroot/example.gitignore
web/d9*/docroot/core
web/d9*/docroot/modules/contrib
web/d9*/docroot/themes/contrib/
web/d9*/docroot/profiles/contrib/
web/d9*/docroot/sites/README.txt


# Ignore regular Composer dependencies
/vendor/
Expand Down
90 changes: 61 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ There are two demo builds included in the package, and you should be sure to che

### solr-7

*This is now the default branch.*
The `solr-7` branch contains release 4.0 and runs Drupal 7.78, 8.9.13, and 9.1.3; testing against Solr 7. The Drupal 8 and 9 versions rely on Search API Solr 4.x.

The `solr-7` branch will contain release 3.0 and is compatible with Drupal 7.69, 8.82 and higher, and Solr 7. It relies on Search API Solr 8.3, and will be Drupal 9 compatible.

This branch uses Search API Federated Solr version 8.x-3.x. All new development is done on this branch.
This branch uses Search API Federated Solr version 4.x. All new development is done on this branch.

### solr-4

This branch is no longer maintained.

The `solr-4` branch contains release 1.0 and is compatible with Drupal 7.69, 8.6 - 8.82, and Solr 4 - 6. Most important, it relies on Search API Solr 8.1, which is no longer maintained. This branch is stable and appropriate for deployment to Acquia, provided your site is not using Solr 7.

This branch uses Search API Federated Solr version 8.x-2.x. No new development is expected on this branch and it is not expected to be Drupal 9 compatible.
Expand Down Expand Up @@ -81,7 +81,7 @@ You may be interested in creating your own development environment and comparing
4. Log in to the virtual machine (the VM): `vagrant ssh`
5. Build, install, and enable demo content: `phing install-all`
* When prompted, you may choose to empty the current SOLR index. This action is recommended when re-installing all sites, but not one site.
* If you wish to install without Domain Access, run `phing install-no-domain`. In that case, two sites will be built with 20 pieces of content.
* If you wish to install without Domain Access, run `phing install-no-domain`. In that case, three sites will be built with 30 pieces of content.
6. Visit your D8 (standalone) site at [http://d8.fs-demo.local](http://d8.fs-demo.local)
7. Visit your D8 (domain access) site at:
- [http://d8-1.fs-demo.local](http://d8-1.fs-demo.local)
Expand All @@ -92,8 +92,9 @@ You may be interested in creating your own development environment and comparing
- [http://d7-1.fs-demo.local](http://d7-1.fs-demo.local)
- [http://d7-2.fs-demo.local](http://d7-2.fs-demo.local)
- [http://d7-3.fs-demo.local](http://d7-3.fs-demo.local)
10. View the Solr index at [http://federated-search-demo.local:8983/solr/#/drupal8/query](http://federated-search-demo.local:8983/solr/#/drupal8/query).
11. See the bare React app (without Drupal) at [http://react.fs-demo.local](http://react.fs-demo.local)
10. Visit your D9 (standalone) site at [http://d9.fs-demo.local](http://d9.fs-demo.local)
11. View the Solr index at [http://federated-search-demo.local:8983/solr/#/drupal8/query](http://federated-search-demo.local:8983/solr/#/drupal8/query).
12. See the bare React app (without Drupal) at [http://react.fs-demo.local](http://react.fs-demo.local)

You can log in to any of the Drupal sites at `/user` with `admin/admin`.

Expand All @@ -107,7 +108,7 @@ To run project-related commands other than `vagrant up` and `vagrant ssh`:
* You'll be in your project root, at the path `/var/www/federated-search-demo.local/`
* You can run `composer`, `drush`, and `phing` commands from here
* Go to the path `/var/www/federated-search-demo.local/web/*` to add new modules to each site.
* Use drush on the D8 sites - try `drush site:alias` or `drush @d8 status`
* Use drush on the D8 and D9 sites - try `drush site:alias` or `drush @d8 status`
* Use drush on the D7 site by navigating into the d7 directory:

```
Expand All @@ -129,56 +130,64 @@ To run project-related commands other than `vagrant up` and `vagrant ssh`:

This version of the demo site is all about dogs. We use simple core content types (basic page and article) supplemented by taxonomy terms. The content titles are meaningful (they are all dog breeds). Content body is lorem ipsum text.

### Date facets
When content is created, it is auto-assigned to a random publication date within the past two weeks from building the site(s).

### Term facets
We create three vocabularies in Drupal 7:

* Age
* Color
* Traits

In Drupal 8, the Color vocabulary is not present. This difference shows how sites with different taxonomies can be integrated in search results.
In Drupal 8 and 9, the Color vocabulary is not present. This difference shows how sites with different taxonomies can be integrated in search results.

Each content page is assigned to the available vocabularies. This setup allows our search index to provide filters by each term.

Note that term mapping in Federated Search lets you alias terms. In the Drupal 7 version, the Color `Gold` is aliased to `Yellow` in the search index, so both terms appear as filters. Likewise, the Drupal 7 term `Affectionate` is mapped to `Loyal`, matching the term from Drupal 8, so only `Loyal` appears in the filter. These configurations show how disparate taxonomies can be merged in the search index.

### Images

Some of the dogs -- but not all -- have images. These show how the index handles image display. The following dogs should have images: `Irish Terrier, English Terrier, Newfoundland, Pointer, Greyhound, Dachshund, Maltese, Cumberland Sheepdog, Dalmation, Toy Spaniel`.
Some of the dogs -- but not all -- have images. These show how the index handles image display. The following dogs should have images: `Irish Terrier, English Terrier, Newfoundland, Pointer, Greyhound, Dachshund, Maltese, Cumberland Sheepdog, Dalmation, Toy Spaniel, Mastiff, Deer Hound, St. Bernard`.

Note that sometimes the image cache must be primed, so if you see a broken image on first page load, reload the page. If an image has the url `default`, it means the index has not been built properly. Run `phing solr-reindex` to correct the issue.

Images are [public domain](https://freevintageillustrations.com/faq/) and sourced from [Free Vintage Illustration](https://freevintageillustrations.com/vintage-dog-illustrations-public-domain/). They are intended for demonstration purposes only.

## Sample searches

By default, the sites will show all content when no search keywords are entered. There should be 32 items in the default result set.
By default, the sites will show all content when no search keywords are entered. There should be 42 items in the default result set.

* Domain 1 - Drupal 7 (3 results)
* Domain 2 - Drupal 7 (2 results)
* Domain 3 - Drupal 7 (3 results)
* Drupal 7 - Federated Search (10 results)
* Federated Search Domain 1 (2 results)
* Federated Search Domain 2 (2 results)
* Federated Search Domain 3 (3 results)
* Federated Search Drupal 8 (10 results)
* Drupal 8 (10 results, Drupal 8)
* Drupal 8 - One (2 results. Drupal 8 with Domain Access)
* Drupal 8 - Two (2 results, Drupal 8 with Domain Access)
* Drupal 8 - Three (3 results, Drupal 8 with Domain Access)
* Drupal 9 (10 results, Drupal 9)
* Search Domain 1 (3 results, Drupal 7 with Domain Access)
* Search Domain 2 (2 results, Drupal 7 with Domain Access)
* Search Domain 3 (3 results, Drupal 7 with Domain Access)
* Search Drupal 7 (10 results, Drupal 7)

Note: Theses numbers add up to more than 32 because some content is assigned to multiple domains.
Note: These numbers add up to more than 42 because some content is assigned to multiple domains.

If you did not install the domain sites, then there will be 20 items:

* Drupal 7 - Federated Search (10 results)
* Federated Search Drupal 8 (10 results)
* Drupal 8 (10 results)
* Drupal 9 (10 results)
* Search Drupal 7 (10 results)

A good sample search is for `terrier`, which should return 5 results (4 without domain support):
A good sample search is for `terrier`, which should return 6 results (5 without domain support):

* English Terrier (D7)
* Jack Russell Terrier (D8)
* Irish Terrier (D7)
* Boston Terrier (D8)
* Norfolk Terrier (D8 Domain 1)
* Welsh Terrier (D9)

These four search results should be identical:
These five search results should be identical:

* http://d9.fs-demo.local/search-app?search=terrier
* http://d8.fs-demo.local/search-app?search=terrier
* http://d7.fs-demo.local/search-app?search=terrier
* http://d8-1.fs-demo.local/search-app?search=terrier
Expand Down Expand Up @@ -241,19 +250,22 @@ If you just want to get up and running, from the project root run `phing install
2. Download the most current dependencies for D8 (domain access): `composer install --working-dir=web/d8-domain`
3. Download the most current dependencies for D7: `composer install --working-dir=web/d7`
4. Download the most current dependencies for D7: `composer install --working-dir=web/d7-domain`
5. Download the most current dependencies for D9 (standalone): `composer install --working-dir=web/d9`
5. Reinstall Drupal 8:
- Standalone: `phing install-d8 -Ddrush.root=web/d8/docroot`
- Domain site: `phing install-d8-domain -Ddrush.root=web/d8-domain/docroot`
6. Reinstall Drupal 7: `phing install-d7`
- Standalone: `phing install-d7 -Ddrush.root=web/d7/docroot`
- Domain site: `phing install-d7-domain -Ddrush.root=web/d7-domain/docroot`
5. Reinstall Drupal 9:
- Standalone: `phing install-d9 -Ddrush.root=web/d9/docroot`
7. Build the `/src` directory and checkout modules there: `phing init`
- This links each of the two modules: `search_api_federated_solr` and `search_api_field_map` from the D8/D7 single site docroot to the `/src` directory and also into the D8/D7 Domain Access-enabled docroot. This means all changes made in `/src/search_api_...` will propagate to both sites simultaneously. The `phing init` command is run automatically by any of the installer scripts.
8. (optional) Run `phing init-git` to run authenticated git checkouts. These git checkouts point to GitHub and have `drupal` aliased remotes to drupal.org (`git remote show`).

### Updating Drupal 8 core

Until we move to Drupal 9, you may run into issues with incompatible versions of `symfony/event-dispatcher`. Search API Solr requires version 4; Drupal 8 core version 3.
When installing Drupal 8, you may run into issues with incompatible versions of `symfony/event-dispatcher`. Search API Solr requires version 4; Drupal 8 core version 3.

To get around this issue, we use `composer require symfony/event-dispatcher:"4.3.3 as 3.4.99"` in both the `web/d8` and `web/d8-domain` directories.

Expand Down Expand Up @@ -285,9 +297,10 @@ You can restart the Solr service from the project within the vm with `sudo servi

## Working with styles

The default CSS for the search application page can be overwritten by a local file. See the Federated Styles module included in the Drupal 8 project for an example.
The default CSS for the search application page can be overwritten by a local file. See the Federated Styles module included in the Drupal 8 and 9 projects for an example.

`/web/d8/docroot/modules/custom/federated_styles`
`/web/d9/docroot/modules/custom/federated_styles`

## Testing without using Drupal

Expand Down Expand Up @@ -315,7 +328,7 @@ The settings for Behat are in `/behat.xml` and tests are in the `/features` dire

## Directory structure

This repo is structured a little differently than usual, since it contains 4 independent Drupal docroots. Here're some important pieces:
This repo is structured a little differently than usual, since it contains 5 independent Drupal docroots and a React docroot. Here are some important pieces:

```

Expand All @@ -327,10 +340,12 @@ This repo is structured a little differently than usual, since it contains 4 ind
│   ├── config_split # Not using this at the moment
│   └── sites # D8 site config goes here
│   └── d8
│   └── d9
├── drush
│   └── sites # Drush aliases go here.
│      ├── d8-domain.site.yml
│      └── d8.site.yml
│      └── d9.site.yml
├── features # Tests could eventually go here.
│   ├── bootstrap
│   │   └── FeatureContext.php
Expand All @@ -346,17 +361,34 @@ This repo is structured a little differently than usual, since it contains 4 ind
│   ├── composer.lock
│   ├── docroot
│   └── vendor
├── d7-domain
│   ├── composer.json
│   ├── composer.lock
│   ├── docroot
│   └── vendor
├── d8
│   ├── composer.json
│   ├── composer.lock
│   ├── docroot
│   └── vendor
│ # Directories for the domain-enabled docroots go here
├── d8-domain
│   ├── composer.json
│   ├── composer.lock
│   ├── docroot
│   └── vendor
├── d9
│   ├── composer.json
│   ├── composer.lock
│   ├── docroot
│   └── vendor
├── react
│   ├── app
│   ├── index.html
```

## Deployment

This project is for demo purposes only and is not to be deployed.

----
Copyright 2018, 2019, 2020 Palantir.net, Inc.
Copyright 2018-2021 Palantir.net, Inc.
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ end
project = 'federated-search-demo'
hostname = "#{project}.local"
extra_hostnames = [
'd9.fs-demo.local',
'd8.fs-demo.local',
'd7.fs-demo.local',
'd7-1.fs-demo.local',
Expand Down
Loading