Merged in release/2023-06-09 (pull request #857)

Release/2023 06 09
This commit is contained in:
Patrick Fic
2023-06-09 22:11:52 +00:00
3 changed files with 57 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
alter table "public"."job_conversations" drop constraint "job_conversations_conversationid_fkey",
add constraint "job_conversations_conversationid_fkey"
foreign key ("conversationid")
references "public"."conversations"
("id") on update restrict on delete restrict;

View File

@@ -0,0 +1,5 @@
alter table "public"."job_conversations" drop constraint "job_conversations_conversationid_fkey",
add constraint "job_conversations_conversationid_fkey"
foreign key ("conversationid")
references "public"."conversations"
("id") on update cascade on delete cascade;

View File

@@ -86,6 +86,7 @@ async function OpenSearchUpdateHandler(req, res) {
"v_model_yr",
"v_make_desc",
"v_model_desc",
"v_vin",
]);
document.bodyshopid = req.body.event.data.new.shopid;
break;
@@ -139,7 +140,7 @@ async function OpenSearchUpdateHandler(req, res) {
"exported_at",
"invoice_number",
"is_credit_memo",
"total"
"total",
]),
...bill.bills_by_pk,
bodyshopid: bill.bills_by_pk.job.shopid,
@@ -244,17 +245,54 @@ async function OpensearchSearchHandler(req, res) {
bool: {
must: [
{
multi_match: {
query: search,
type: "phrase_prefix",
//fields: ["*"],
// fuzziness: "5",
//prefix_length: 2,
match: {
bodyshopid: assocs.associations[0].shopid,
},
},
{
match: {
bodyshopid: assocs.associations[0].shopid,
bool: {
should: [
{
multi_match: {
query: search,
type: "cross_fields",
fields: ["*ownr_fn", "*ownr_ln"],
},
},
{
multi_match: {
query: search,
type: "most_fields",
fields: [
"*v_model_yr",
"*v_make_desc^2",
"*v_model_desc^3",
],
},
},
{
query_string: {
query: `*${search}*`,
fields: [
"*ro_number^20",
"*clm_no^14",
"*v_vin^12",
"*plate_no^12",
"*ownr_ln^10",
"transactionid^10",
"paymentnum^10",
"invoice_number^10",
"*ownr_fn^8",
"*ownr_co_nm^8",
"*ownr_ph1^8",
"*ownr_ph2^8",
"*",
],
},
},
],
minimum_should_match: 1,
},
},
],