Skip to content

Commit

Permalink
Merge pull request #788 from mwiencek/kill-ws1
Browse files Browse the repository at this point in the history
Prepare for SOLR access via search.mb.org (MBH-502)
  • Loading branch information
mwiencek committed May 27, 2020
2 parents 99b4031 + aa0caa5 commit 5170de7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ The server by itself doesn't rate limit any request it handles. If you're
receiving 503s, then you're likely performing
[search queries](https://musicbrainz.org/doc/Search_Server) without having set
up a local instance of the
[search server](https://github.com/metabrainz/search-server). By default,
[search server](https://github.com/metabrainz/mb-solr) along with the
[search index rebuilder](https://github.com/metabrainz/sir). By default,
search queries are sent to search.musicbrainz.org and are rate limited.

Once you set up your own instance, change `SEARCH_SERVER` in lib/DBDefs.pm to
Expand Down
2 changes: 1 addition & 1 deletion lib/DBDefs.pm.sample
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ sub WEB_SERVER { "www.musicbrainz.example.com" }
# Relevant only if SSL redirects are enabled
# sub WEB_SERVER_SSL { "localhost" }
# sub SEARCH_SERVER { "search.musicbrainz.org" }
# sub SEARCH_ENGINE { "LUCENE" }
# sub SEARCH_ENGINE { "SOLR" }
# Used, for example, to have emails sent from the beta server list the
# main server
# sub WEB_SERVER_USED_IN_EMAIL { my $self = shift; $self->WEB_SERVER }
Expand Down
2 changes: 1 addition & 1 deletion lib/DBDefs/Default.pm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ sub WEB_SERVER { "localhost:5000" }
# Relevant only if SSL redirects are enabled
sub WEB_SERVER_SSL { "localhost" }
sub SEARCH_SERVER { "search.musicbrainz.org" }
sub SEARCH_ENGINE { "LUCENE" }
sub SEARCH_ENGINE { "SOLR" }
# Whether to use x-accel-redirect for webservice searches,
# using /internal/search as the internal redirect
sub SEARCH_X_ACCEL_REDIRECT { 0 }
Expand Down
2 changes: 1 addition & 1 deletion lib/MusicBrainz/Server/Data/Search.pm
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ sub external_search
$type =~ s/release_group/release-group/;

my $search_url_string;
if (DBDefs->SEARCH_ENGINE eq 'LUCENE') {
if (DBDefs->SEARCH_ENGINE eq 'LUCENE' || DBDefs->SEARCH_SERVER eq DBDefs::Default->SEARCH_SERVER) {
my $dismax = $adv ? 'false' : 'true';
$search_url_string = "http://%s/ws/2/%s/?query=%s&offset=%s&max=%s&fmt=jsonnew&dismax=$dismax&web=1";
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/MusicBrainz/Server/Data/WebService.pm
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ sub xml_search
}

my $url_ext;
if (DBDefs->SEARCH_ENGINE eq 'LUCENE') {
if (DBDefs->SEARCH_ENGINE eq 'LUCENE' || DBDefs->SEARCH_SERVER eq DBDefs::Default->SEARCH_SERVER) {
my $format = ($args->{fmt} // "") eq "json" ? "jsonnew" : "xml";
$url_ext = "/ws/2/$resource/?" .
"max=$limit&type=$resource&fmt=$format&offset=$offset" .
Expand Down

0 comments on commit 5170de7

Please sign in to comment.