@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -86,6 +86,7 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
"v_model_yr",
|
"v_model_yr",
|
||||||
"v_make_desc",
|
"v_make_desc",
|
||||||
"v_model_desc",
|
"v_model_desc",
|
||||||
|
"v_vin",
|
||||||
]);
|
]);
|
||||||
document.bodyshopid = req.body.event.data.new.shopid;
|
document.bodyshopid = req.body.event.data.new.shopid;
|
||||||
break;
|
break;
|
||||||
@@ -139,7 +140,7 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
"exported_at",
|
"exported_at",
|
||||||
"invoice_number",
|
"invoice_number",
|
||||||
"is_credit_memo",
|
"is_credit_memo",
|
||||||
"total"
|
"total",
|
||||||
]),
|
]),
|
||||||
...bill.bills_by_pk,
|
...bill.bills_by_pk,
|
||||||
bodyshopid: bill.bills_by_pk.job.shopid,
|
bodyshopid: bill.bills_by_pk.job.shopid,
|
||||||
@@ -244,17 +245,54 @@ async function OpensearchSearchHandler(req, res) {
|
|||||||
bool: {
|
bool: {
|
||||||
must: [
|
must: [
|
||||||
{
|
{
|
||||||
multi_match: {
|
match: {
|
||||||
query: search,
|
bodyshopid: assocs.associations[0].shopid,
|
||||||
type: "phrase_prefix",
|
|
||||||
//fields: ["*"],
|
|
||||||
// fuzziness: "5",
|
|
||||||
//prefix_length: 2,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: {
|
bool: {
|
||||||
bodyshopid: assocs.associations[0].shopid,
|
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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user