Skip to content

Commit

Permalink
Port minor improvements suggested by @Bomme
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Feb 13, 2024
1 parent b982aa0 commit 32d8611
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions sounds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32d8611

Please sign in to comment.