diff --git a/README.md b/README.md index 9e2ff7a93..351903eb4 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Below are instructions for setting up a local Freesound installation for develop Because the `web` container mounts a named volume for the home folder of the user running the shell plus process, command history should be kept between container runs :) -16. (extra step) The steps above will get Freesound running, but to save resources in your local machine some non-essential services will not be started by default. If you look at the `docker compose.yml` file, you'll see that some services are marked with the profile `analyzers` or `all`. These services include sound similarity, search results clustering and the audio analyzers. To run these services you need to explicitly tell `docker compose` using the `--profile` (note that some services need additional configuration steps (see *Freesound analysis pipeline* section in `DEVELOPERS.md`): +16. (extra step) The steps above will get Freesound running, but to save resources in your local machine some non-essential services will not be started by default. If you look at the `docker-compose.yml` file, you'll see that some services are marked with the profile `analyzers` or `all`. These services include sound similarity, search results clustering and the audio analyzers. To run these services you need to explicitly tell `docker compose` using the `--profile` (note that some services need additional configuration steps (see *Freesound analysis pipeline* section in `DEVELOPERS.md`): docker compose --profile analyzers up # To run all basic services + sound analyzers docker compose --profile all up # To run all services diff --git a/sounds/views.py b/sounds/views.py index 0a8c67596..63508fd69 100644 --- a/sounds/views.py +++ b/sounds/views.py @@ -825,16 +825,17 @@ def similar(request, username, sound_id): if sound.user.username.lower() != username.lower(): raise Http404 + num_similar_sounds = settings.NUM_SIMILAR_SOUNDS_PER_PAGE * settings.NUM_SIMILAR_SOUNDS_PAGES if not settings.USE_SEARCH_ENGINE_SIMILARITY: # Get similar sounds from similarity service (gaia) similarity_results, _ = get_similar_sounds( - sound, request.GET.get('preset', None), settings.NUM_SIMILAR_SOUNDS_PER_PAGE * settings.NUM_SIMILAR_SOUNDS_PAGES) + sound, request.GET.get('preset', None), num_similar_sounds) else: # Get similar sounds from solr try: results = get_search_engine().search_sounds(similar_to=sound.id, - similar_to_max_num_sounds=settings.NUM_SIMILAR_SOUNDS_PER_PAGE * settings.NUM_SIMILAR_SOUNDS_PAGES, - num_sounds=settings.NUM_SIMILAR_SOUNDS_PER_PAGE * settings.NUM_SIMILAR_SOUNDS_PAGES) + similar_to_max_num_sounds=num_similar_sounds, + num_sounds=num_similar_sounds) similarity_results = [(result['id'], result['score']) for result in results.docs] except SearchEngineException: # Search engine not available, return empty list diff --git a/utils/search/__init__.py b/utils/search/__init__.py index d2f904f22..8e69aa951 100644 --- a/utils/search/__init__.py +++ b/utils/search/__init__.py @@ -233,7 +233,7 @@ def search_sounds(self, textual_query='', query_fields=None, query_filter='', fi sort=settings.SEARCH_SOUNDS_SORT_OPTION_AUTOMATIC, group_by_pack=False, num_sounds_per_pack_group=1, facets=None, only_sounds_with_pack=False, only_sounds_within_ids=False, group_counts_as_one_in_facets=False, - simialr_to=None, similar_to_max_num_sounds=settings.SEARCH_ENGINE_NUM_SIMILAR_SOUNDS_PER_QUERY, + similar_to=None, similar_to_max_num_sounds=settings.SEARCH_ENGINE_NUM_SIMILAR_SOUNDS_PER_QUERY, similar_to_analyzer=settings.SEARCH_ENGINE_DEFAULT_SIMILARITY_ANALYZER): """Search for sounds that match specific criteria and return them in a SearchResults object