Compare commits
No commits in common. "0265ad35c95425bddb3c2dcd0abb5419e3236d51" and "5c028e75a7556af04ae841c5b64c844c628442ec" have entirely different histories.
0265ad35c9
...
5c028e75a7
|
@ -44,7 +44,7 @@ function initUiActions(_store, _router) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
release {
|
release: releaseById {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
slug
|
slug
|
||||||
|
|
|
@ -1001,9 +1001,10 @@ exports.up = knex => Promise.resolve()
|
||||||
// allow vim fold
|
// allow vim fold
|
||||||
return knex.raw(`
|
return knex.raw(`
|
||||||
/* We need both the release entries and their search ranking, and PostGraphile does not seem to allow virtual foreign keys on function results.
|
/* We need both the release entries and their search ranking, and PostGraphile does not seem to allow virtual foreign keys on function results.
|
||||||
* Using a table as a proxy for the search results allows us to get both a reference to the releases table, and the ranking.
|
* Using a view as a proxy for the search results allows us to get both a reference to the releases table, and the ranking.
|
||||||
* A composite type does not seem to be compatible with PostGraphile's @sortable, and a view does not allow for many native constraints */
|
* A composite type does not seem to be compatible with PostGraphile's @sortable. */
|
||||||
CREATE TABLE releases_search_results (release_id integer, rank real, FOREIGN KEY (release_id) REFERENCES releases (id));
|
CREATE VIEW releases_search_results AS
|
||||||
|
SELECT NULL::integer as id, NULL::real as rank;
|
||||||
|
|
||||||
CREATE FUNCTION search_releases(query text) RETURNS SETOF releases_search_results AS $$
|
CREATE FUNCTION search_releases(query text) RETURNS SETOF releases_search_results AS $$
|
||||||
SELECT releases.id, ranks.rank FROM (
|
SELECT releases.id, ranks.rank FROM (
|
||||||
|
@ -1181,6 +1182,8 @@ exports.up = knex => Promise.resolve()
|
||||||
COMMENT ON FUNCTION actors_scenes IS E'@sortable';
|
COMMENT ON FUNCTION actors_scenes IS E'@sortable';
|
||||||
COMMENT ON FUNCTION tags_scenes IS E'@sortable';
|
COMMENT ON FUNCTION tags_scenes IS E'@sortable';
|
||||||
COMMENT ON FUNCTION search_releases IS E'@sortable';
|
COMMENT ON FUNCTION search_releases IS E'@sortable';
|
||||||
|
|
||||||
|
COMMENT ON VIEW releases_search_results is E'@foreignKey (id) REFERENCES releases (id)';
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1242,6 +1245,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
|
||||||
DROP TABLE IF EXISTS entities_types CASCADE;
|
DROP TABLE IF EXISTS entities_types CASCADE;
|
||||||
DROP TABLE IF EXISTS entities CASCADE;
|
DROP TABLE IF EXISTS entities CASCADE;
|
||||||
|
|
||||||
|
DROP FUNCTION IF EXISTS search_releases_legacy;
|
||||||
DROP FUNCTION IF EXISTS search_releases;
|
DROP FUNCTION IF EXISTS search_releases;
|
||||||
DROP FUNCTION IF EXISTS search_sites;
|
DROP FUNCTION IF EXISTS search_sites;
|
||||||
DROP FUNCTION IF EXISTS search_entities;
|
DROP FUNCTION IF EXISTS search_entities;
|
||||||
|
@ -1258,6 +1262,9 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
|
||||||
DROP FUNCTION IF EXISTS movies_tags;
|
DROP FUNCTION IF EXISTS movies_tags;
|
||||||
DROP FUNCTION IF EXISTS movies_photos;
|
DROP FUNCTION IF EXISTS movies_photos;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS releases_search_results;
|
DROP VIEW IF EXISTS releases_search_results;
|
||||||
|
|
||||||
|
DROP TEXT SEARCH CONFIGURATION IF EXISTS traxxx;
|
||||||
|
DROP TEXT SEARCH DICTIONARY IF EXISTS traxxx_dict;
|
||||||
`);
|
`);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.175.4",
|
"version": "1.175.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "1.175.4",
|
"version": "1.175.3",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@graphile-contrib/pg-order-by-related": "^1.0.0-beta.6",
|
"@graphile-contrib/pg-order-by-related": "^1.0.0-beta.6",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.175.4",
|
"version": "1.175.3",
|
||||||
"description": "All the latest porn releases in one place",
|
"description": "All the latest porn releases in one place",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -13,7 +13,6 @@ function curateRelease(release, withMedia = false, withPoster = true) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: release.id,
|
id: release.id,
|
||||||
...(release.relevance && { relevance: release.relevance }),
|
|
||||||
entryId: release.entry_id,
|
entryId: release.entry_id,
|
||||||
shootId: release.shoot_id,
|
shootId: release.shoot_id,
|
||||||
title: release.title,
|
title: release.title,
|
||||||
|
@ -135,13 +134,9 @@ async function fetchScenes(limit = 100) {
|
||||||
|
|
||||||
async function searchScenes(query, limit = 100) {
|
async function searchScenes(query, limit = 100) {
|
||||||
const releases = await knex
|
const releases = await knex
|
||||||
.select(knex.raw('search_results.rank as relevance'))
|
.from(knex.raw('search_releases(:query) as releases', { query }))
|
||||||
.from(knex.raw('search_releases(:query) as search_results', { query }))
|
|
||||||
.leftJoin('releases', 'releases.id', 'search_results.release_id')
|
|
||||||
.modify(withRelations, false, true)
|
.modify(withRelations, false, true)
|
||||||
.limit(Math.min(limit, 1000000))
|
.limit(Math.min(limit, 1000000));
|
||||||
.groupBy('search_results.rank')
|
|
||||||
.orderBy('search_results.rank', 'desc');
|
|
||||||
|
|
||||||
return releases.map(release => curateRelease(release));
|
return releases.map(release => curateRelease(release));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue