fix search index for array fields
This commit is contained in:
parent
563fd4a02f
commit
724f124a83
13 changed files with 49 additions and 26 deletions
|
@ -64,8 +64,9 @@ class Album(Item):
|
||||||
duration = jsondata.IntegerField(
|
duration = jsondata.IntegerField(
|
||||||
_("length"), null=True, blank=True, help_text=_("milliseconds")
|
_("length"), null=True, blank=True, help_text=_("milliseconds")
|
||||||
)
|
)
|
||||||
artist = jsondata.JSONField(
|
artist = jsondata.ArrayField(
|
||||||
verbose_name=_("artist"),
|
verbose_name=_("artist"),
|
||||||
|
base_field=models.CharField(blank=True, default="", max_length=100),
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
default=list,
|
default=list,
|
||||||
|
|
|
@ -3,7 +3,6 @@ from typing import TYPE_CHECKING
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from ninja import Field
|
from ninja import Field
|
||||||
from typing_extensions import deprecated
|
|
||||||
|
|
||||||
from catalog.common import (
|
from catalog.common import (
|
||||||
BaseSchema,
|
BaseSchema,
|
||||||
|
@ -52,8 +51,9 @@ class Podcast(Item):
|
||||||
|
|
||||||
language = LanguageListField()
|
language = LanguageListField()
|
||||||
|
|
||||||
host = jsondata.JSONField(
|
host = jsondata.ArrayField(
|
||||||
verbose_name=_("host"),
|
verbose_name=_("host"),
|
||||||
|
base_field=models.CharField(blank=True, default="", max_length=200),
|
||||||
null=False,
|
null=False,
|
||||||
blank=False,
|
blank=False,
|
||||||
default=list,
|
default=list,
|
||||||
|
|
|
@ -297,6 +297,8 @@ class Indexer:
|
||||||
for field in obj.__class__.indexable_fields_dict:
|
for field in obj.__class__.indexable_fields_dict:
|
||||||
if field.startswith("localized_"):
|
if field.startswith("localized_"):
|
||||||
item[field] = [t["text"] for t in getattr(obj, field, [])]
|
item[field] = [t["text"] for t in getattr(obj, field, [])]
|
||||||
|
elif field in ["actor", "crew"]:
|
||||||
|
item[field] = [t["name"] for t in getattr(obj, field, [])]
|
||||||
|
|
||||||
item["id"] = obj.uuid
|
item["id"] = obj.uuid
|
||||||
item["category"] = obj.category.value
|
item["category"] = obj.category.value
|
||||||
|
|
|
@ -8,10 +8,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include '_people.html' with people=item.author role='author' max=2 %}
|
{% include '_people.html' with people=item.author role='author' max=2 %}
|
||||||
{% include '_people.html' with people=item.translator role='translator' max=2 %}
|
{% include '_people.html' with people=item.translator role='translator' max=2 %}
|
||||||
{% include '_people.html' with people=item.director role='director' max=2 %}
|
|
||||||
{% include '_people.html' with people=item.hosts role='' max=2 %}
|
|
||||||
{% include '_people.html' with people=item.artist role='' max=2 %}
|
|
||||||
{% include '_people.html' with people=item.developer role='' max=2 %}
|
|
||||||
{% if item.pub_house %}<span>{{ item.pub_house }}</span>{% endif %}
|
{% if item.pub_house %}<span>{{ item.pub_house }}</span>{% endif %}
|
||||||
{% if item.pub_year %}
|
{% if item.pub_year %}
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% if item.rating %}
|
{% if item.rating %}
|
||||||
<span class="solo-hidden">{{ item.rating | floatformat:1 }} <small>({{ item.rating_count }} {% trans "ratings" %})</small></span>
|
<span class="solo-hidden">{{ item.rating | floatformat:1 }} <small>({{ item.rating_count }} {% trans "ratings" %})</small></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include '_people.html' with people=item.hosts role='host' max=5 %}
|
{% include '_people.html' with people=item.host role='host' max=5 %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock brief %}
|
{% endblock brief %}
|
||||||
{% block full %}
|
{% block full %}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
data-position="{{ comment.metadata.position|default:0 }}"
|
data-position="{{ comment.metadata.position|default:0 }}"
|
||||||
data-cover="{{ comment.item.cover_url|default:item.cover.url }}"
|
data-cover="{{ comment.item.cover_url|default:item.cover.url }}"
|
||||||
class="episode"
|
class="episode"
|
||||||
data-hosts="{{ item.hosts|join:' / ' }}"
|
data-hosts="{{ item.host|join:' / ' }}"
|
||||||
data-title="{{ comment.item.display_title }}"
|
data-title="{{ comment.item.display_title }}"
|
||||||
data-album="{{ item.display_title }}"
|
data-album="{{ item.display_title }}"
|
||||||
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' comment.item.uuid %}" {% endif %}
|
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' comment.item.uuid %}" {% endif %}
|
||||||
|
|
|
@ -36,7 +36,7 @@ window.player = new Shikwasa.Player({
|
||||||
cover: "{{ focus_item.cover_url | default:item.cover.url | escapejs }}",
|
cover: "{{ focus_item.cover_url | default:item.cover.url | escapejs }}",
|
||||||
src: "{{ focus_item.media_url | escapejs }}",
|
src: "{{ focus_item.media_url | escapejs }}",
|
||||||
album: "{{ item.display_title|escapejs }}",
|
album: "{{ item.display_title|escapejs }}",
|
||||||
artist: "{{ item.hosts|join:' / '|escapejs }}"
|
artist: "{{ item.host|join:' / '|escapejs }}"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (position) window.player._initSeek = position;
|
if (position) window.player._initSeek = position;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block details %}
|
{% block details %}
|
||||||
<div>{% include '_people.html' with people=item.genre role='genre' max=5 %}</div>
|
<div>{% include '_people.html' with people=item.genre role='genre' max=5 %}</div>
|
||||||
<div>{% include '_people.html' with people=item.hosts role='podcast host' max=5 %}</div>
|
<div>{% include '_people.html' with people=item.host role='podcast host' max=5 %}</div>
|
||||||
<div>
|
<div>
|
||||||
{% if item.official_site %}
|
{% if item.official_site %}
|
||||||
{% trans 'website' %}: {{ item.official_site|urlizetrunc:24 }}
|
{% trans 'website' %}: {{ item.official_site|urlizetrunc:24 }}
|
||||||
|
@ -51,7 +51,7 @@ $(()=>{
|
||||||
cover: "{{ focus_item.cover_url | default:item.cover.url | escapejs }}",
|
cover: "{{ focus_item.cover_url | default:item.cover.url | escapejs }}",
|
||||||
src: "{{ focus_item.media_url | escapejs }}",
|
src: "{{ focus_item.media_url | escapejs }}",
|
||||||
album: "{{ item.display_title|escapejs }}",
|
album: "{{ item.display_title|escapejs }}",
|
||||||
artist: "{{ item.hosts|join:' / '|escapejs }}"
|
artist: "{{ item.host|join:' / '|escapejs }}"
|
||||||
})
|
})
|
||||||
if (position) window.player._initSeek = position;
|
if (position) window.player._initSeek = position;
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
data-uuid="{{ ep.uuid }}"
|
data-uuid="{{ ep.uuid }}"
|
||||||
data-title="{{ ep.display_title }}"
|
data-title="{{ ep.display_title }}"
|
||||||
data-album="{{ item.display_title }}"
|
data-album="{{ item.display_title }}"
|
||||||
data-hosts="{{ item.hosts|join:' / ' }}"
|
data-hosts="{{ item.host|join:' / ' }}"
|
||||||
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' ep.uuid %}" {% endif %}
|
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' ep.uuid %}" {% endif %}
|
||||||
style="top:4px;
|
style="top:4px;
|
||||||
margin-right: 8px"></a>
|
margin-right: 8px"></a>
|
||||||
|
|
|
@ -372,9 +372,9 @@ class TVSeason(Item):
|
||||||
blank=True,
|
blank=True,
|
||||||
default=list,
|
default=list,
|
||||||
)
|
)
|
||||||
language = jsondata.JSONField(
|
language = jsondata.ArrayField(
|
||||||
verbose_name=_("language"),
|
verbose_name=_("language"),
|
||||||
# base_field=models.CharField(blank=True, default="", max_length=100, choices=LANGUAGE_CHOICES ),
|
base_field=models.CharField(blank=True, default="", max_length=100),
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
default=list,
|
default=list,
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
data-cover="{{ item.cover_url|default:item.program.cover.url }}"
|
data-cover="{{ item.cover_url|default:item.program.cover.url }}"
|
||||||
data-title="{{ item.display_title }}"
|
data-title="{{ item.display_title }}"
|
||||||
data-album="{{ item.program.display_title }}"
|
data-album="{{ item.program.display_title }}"
|
||||||
data-hosts="{{ item.program.hosts|join:' / ' }}"
|
data-hosts="{{ item.program.host|join:' / ' }}"
|
||||||
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' item.uuid %}" {% endif %}
|
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' item.uuid %}" {% endif %}
|
||||||
data-position="0"
|
data-position="0"
|
||||||
href="{{ item.url }}"
|
href="{{ item.url }}"
|
||||||
|
|
42
compose.yml
42
compose.yml
|
@ -122,7 +122,7 @@ services:
|
||||||
- ${NEODB_DATA:-../data}/redis:/data
|
- ${NEODB_DATA:-../data}/redis:/data
|
||||||
|
|
||||||
typesense:
|
typesense:
|
||||||
image: typesense/typesense:0.25.2
|
image: typesense/typesense:${TYPESENSE_VERSION:-0.25.2}
|
||||||
restart: "on-failure"
|
restart: "on-failure"
|
||||||
# healthcheck:
|
# healthcheck:
|
||||||
# test: ['CMD', 'curl', '-vf', 'http://127.0.0.1:8108/health']
|
# test: ['CMD', 'curl', '-vf', 'http://127.0.0.1:8108/health']
|
||||||
|
@ -132,12 +132,12 @@ services:
|
||||||
GLOG_minloglevel: 2
|
GLOG_minloglevel: 2
|
||||||
volumes:
|
volumes:
|
||||||
- ${NEODB_DATA:-../data}/typesense:/data
|
- ${NEODB_DATA:-../data}/typesense:/data
|
||||||
command: '--data-dir /data --api-key=eggplant'
|
command: "--data-dir /data --api-key=eggplant"
|
||||||
|
|
||||||
neodb-db:
|
neodb-db:
|
||||||
image: postgres:14-alpine
|
image: postgres:${POSTGRES_VERSION:-14-alpine}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'pg_isready', '-U', 'neodb']
|
test: ["CMD", "pg_isready", "-U", "neodb"]
|
||||||
volumes:
|
volumes:
|
||||||
- ${NEODB_DATA:-../data}/neodb-db:/var/lib/postgresql/data
|
- ${NEODB_DATA:-../data}/neodb-db:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
|
@ -146,9 +146,9 @@ services:
|
||||||
- POSTGRES_PASSWORD=aubergine
|
- POSTGRES_PASSWORD=aubergine
|
||||||
|
|
||||||
takahe-db:
|
takahe-db:
|
||||||
image: postgres:14-alpine
|
image: postgres:${POSTGRES_VERSION:-14-alpine}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'pg_isready', '-U', 'takahe']
|
test: ["CMD", "pg_isready", "-U", "takahe"]
|
||||||
volumes:
|
volumes:
|
||||||
- ${NEODB_DATA:-../data}/takahe-db:/var/lib/postgresql/data
|
- ${NEODB_DATA:-../data}/takahe-db:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
|
@ -174,7 +174,15 @@ services:
|
||||||
<<: *neodb-service
|
<<: *neodb-service
|
||||||
command: ${NEODB_VENV:-/neodb-venv}/bin/gunicorn boofilsic.wsgi -w ${NEODB_WEB_WORKER_NUM:-8} --preload --max-requests 2000 --timeout 60 -b 0.0.0.0:8000
|
command: ${NEODB_VENV:-/neodb-venv}/bin/gunicorn boofilsic.wsgi -w ${NEODB_WEB_WORKER_NUM:-8} --preload --max-requests 2000 --timeout 60 -b 0.0.0.0:8000
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'wget', '-qO/tmp/test', '--header', 'X-Forwarded-Proto: https', 'http://127.0.0.1:8000/nodeinfo/2.0/']
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"wget",
|
||||||
|
"-qO/tmp/test",
|
||||||
|
"--header",
|
||||||
|
"X-Forwarded-Proto: https",
|
||||||
|
"http://127.0.0.1:8000/nodeinfo/2.0/",
|
||||||
|
]
|
||||||
depends_on:
|
depends_on:
|
||||||
migration:
|
migration:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
|
@ -183,7 +191,15 @@ services:
|
||||||
<<: *neodb-service
|
<<: *neodb-service
|
||||||
command: ${NEODB_VENV:-/neodb-venv}/bin/gunicorn boofilsic.wsgi -w ${NEODB_API_WORKER_NUM:-4} --preload --max-requests 2000 --timeout 30 -b 0.0.0.0:8000
|
command: ${NEODB_VENV:-/neodb-venv}/bin/gunicorn boofilsic.wsgi -w ${NEODB_API_WORKER_NUM:-4} --preload --max-requests 2000 --timeout 30 -b 0.0.0.0:8000
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'wget', '-qO/tmp/test', '--header', 'X-Forwarded-Proto: https', 'http://127.0.0.1:8000/nodeinfo/2.0/']
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"wget",
|
||||||
|
"-qO/tmp/test",
|
||||||
|
"--header",
|
||||||
|
"X-Forwarded-Proto: https",
|
||||||
|
"http://127.0.0.1:8000/nodeinfo/2.0/",
|
||||||
|
]
|
||||||
depends_on:
|
depends_on:
|
||||||
migration:
|
migration:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
|
@ -206,7 +222,15 @@ services:
|
||||||
<<: *neodb-service
|
<<: *neodb-service
|
||||||
command: ${TAKAHE_VENV:-/takahe-venv}/bin/gunicorn --chdir /takahe takahe.wsgi -w ${TAKAHE_WEB_WORKER_NUM:-8} --max-requests 2000 --timeout 60 --preload -b 0.0.0.0:8000
|
command: ${TAKAHE_VENV:-/takahe-venv}/bin/gunicorn --chdir /takahe takahe.wsgi -w ${TAKAHE_WEB_WORKER_NUM:-8} --max-requests 2000 --timeout 60 --preload -b 0.0.0.0:8000
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'wget', '-qO/tmp/test', '--header', 'X-Forwarded-Proto: https', 'http://127.0.0.1:8000/api/v1/instance']
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"wget",
|
||||||
|
"-qO/tmp/test",
|
||||||
|
"--header",
|
||||||
|
"X-Forwarded-Proto: https",
|
||||||
|
"http://127.0.0.1:8000/api/v1/instance",
|
||||||
|
]
|
||||||
depends_on:
|
depends_on:
|
||||||
migration:
|
migration:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
data-cover="{{ item.cover_url|default:item.parent_item.cover.url }}"
|
data-cover="{{ item.cover_url|default:item.parent_item.cover.url }}"
|
||||||
data-title="{{ item.display_title }}"
|
data-title="{{ item.display_title }}"
|
||||||
data-album="{{ item.parent_item.display_title }}"
|
data-album="{{ item.parent_item.display_title }}"
|
||||||
data-hosts="{{ item.parent_item.hosts|join:' / ' }}"
|
data-hosts="{{ item.parent_item.host|join:' / ' }}"
|
||||||
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' item.uuid %}" {% endif %}
|
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' item.uuid %}" {% endif %}
|
||||||
data-position="{{ piece.metadata.position | default:0 }}"><i class="fa-solid fa-circle-play"></i></a>
|
data-position="{{ piece.metadata.position | default:0 }}"><i class="fa-solid fa-circle-play"></i></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue