This commit is contained in:
@@ -173,36 +173,7 @@ namespace AyaNova.Util
|
|||||||
await ExecQueryAsync("CREATE INDEX asearchkey_wordid_otype_idx ON asearchkey (wordid, objecttype);");
|
await ExecQueryAsync("CREATE INDEX asearchkey_wordid_otype_idx ON asearchkey (wordid, objecttype);");
|
||||||
|
|
||||||
//Search indexing stored procedure
|
//Search indexing stored procedure
|
||||||
// await ExecQueryAsync(@"CREATE OR REPLACE PROCEDURE public.aydosearchindex(
|
await ExecQueryAsync(@"CREATE OR REPLACE PROCEDURE public.aydosearchindex(
|
||||||
// wordlist text[],
|
|
||||||
// ayobjectid bigint,
|
|
||||||
// ayobjecttype integer)
|
|
||||||
// LANGUAGE 'plpgsql'
|
|
||||||
|
|
||||||
// AS $BODY$DECLARE
|
|
||||||
// s text;
|
|
||||||
// wordid bigint;
|
|
||||||
// BEGIN
|
|
||||||
// IF ayobjectid=0 THEN
|
|
||||||
// RAISE EXCEPTION 'Bad object id --> %', ayobjectid;
|
|
||||||
// END IF;
|
|
||||||
|
|
||||||
// IF ayobjecttype=0 THEN
|
|
||||||
// RAISE EXCEPTION 'Bad object type --> %', ayobjecttype;
|
|
||||||
// END IF;
|
|
||||||
|
|
||||||
|
|
||||||
// delete from asearchkey where objectid=ayobjectid and objecttype=ayobjecttype;
|
|
||||||
|
|
||||||
// FOREACH s IN ARRAY wordlist
|
|
||||||
// LOOP
|
|
||||||
// insert into asearchdictionary (word) values(s) on conflict (word) do update set word=excluded.word returning id into wordid;
|
|
||||||
// insert into asearchkey (wordid,objectid,objecttype) values(wordid,ayobjectid,ayobjecttype);
|
|
||||||
// END LOOP;
|
|
||||||
// END;
|
|
||||||
// $BODY$;");
|
|
||||||
|
|
||||||
await ExecQueryAsync(@"CREATE OR REPLACE PROCEDURE public.aydosearchindex(
|
|
||||||
wordlist text[],
|
wordlist text[],
|
||||||
ayobjectid bigint,
|
ayobjectid bigint,
|
||||||
ayobjecttype integer)
|
ayobjecttype integer)
|
||||||
@@ -225,13 +196,42 @@ delete from asearchkey where objectid=ayobjectid and objecttype=ayobjecttype;
|
|||||||
|
|
||||||
FOREACH s IN ARRAY wordlist
|
FOREACH s IN ARRAY wordlist
|
||||||
LOOP
|
LOOP
|
||||||
insert into asearchdictionary (word) values(s) on conflict (word) do nothing;
|
insert into asearchdictionary (word) values(s) on conflict (word) do update set word=excluded.word returning id into wordid;
|
||||||
SELECT id INTO STRICT wordid FROM asearchdictionary WHERE word = s;
|
|
||||||
insert into asearchkey (wordid,objectid,objecttype) values(wordid,ayobjectid,ayobjecttype);
|
insert into asearchkey (wordid,objectid,objecttype) values(wordid,ayobjectid,ayobjecttype);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END;
|
END;
|
||||||
$BODY$;");
|
$BODY$;");
|
||||||
|
|
||||||
|
// await ExecQueryAsync(@"CREATE OR REPLACE PROCEDURE public.aydosearchindex(
|
||||||
|
// wordlist text[],
|
||||||
|
// ayobjectid bigint,
|
||||||
|
// ayobjecttype integer)
|
||||||
|
// LANGUAGE 'plpgsql'
|
||||||
|
|
||||||
|
// AS $BODY$DECLARE
|
||||||
|
// s text;
|
||||||
|
// wordid bigint;
|
||||||
|
// BEGIN
|
||||||
|
// IF ayobjectid=0 THEN
|
||||||
|
// RAISE EXCEPTION 'Bad object id --> %', ayobjectid;
|
||||||
|
// END IF;
|
||||||
|
|
||||||
|
// IF ayobjecttype=0 THEN
|
||||||
|
// RAISE EXCEPTION 'Bad object type --> %', ayobjecttype;
|
||||||
|
// END IF;
|
||||||
|
|
||||||
|
|
||||||
|
// delete from asearchkey where objectid=ayobjectid and objecttype=ayobjecttype;
|
||||||
|
|
||||||
|
// FOREACH s IN ARRAY wordlist
|
||||||
|
// LOOP
|
||||||
|
// insert into asearchdictionary (word) values(s) on conflict (word) do nothing;
|
||||||
|
// SELECT id INTO STRICT wordid FROM asearchdictionary WHERE word = s;
|
||||||
|
// insert into asearchkey (wordid,objectid,objecttype) values(wordid,ayobjectid,ayobjecttype);
|
||||||
|
// END LOOP;
|
||||||
|
// END;
|
||||||
|
// $BODY$;");
|
||||||
|
|
||||||
//create translation text tables
|
//create translation text tables
|
||||||
await ExecQueryAsync("CREATE TABLE atranslation (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null, stock bool, cjkindex bool default false)");
|
await ExecQueryAsync("CREATE TABLE atranslation (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null, stock bool, cjkindex bool default false)");
|
||||||
//LOOKAT: I don't think this is doing anything:
|
//LOOKAT: I don't think this is doing anything:
|
||||||
|
|||||||
Reference in New Issue
Block a user