From c134f78421048f4077796f56bf40a28de9baf018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Wed, 11 Nov 2020 18:02:11 +0100 Subject: [PATCH] Update - Ajout de la recherche du nom du producteur pour search products --- Sheaft.Application.Queries/ProductQueries.cs | 2 +- Sheaft.Infrastructure.Persistence/Data/init.txt | 2 +- .../Indexes/azsearch_index_products.json | 15 +++++++++++++++ .../Migrations/20201030160301_InitDatabase.cs | 2 +- .../Scripts/view_productsSearch.sql | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Sheaft.Application.Queries/ProductQueries.cs b/Sheaft.Application.Queries/ProductQueries.cs index 9a8d7874b..8ecfba114 100644 --- a/Sheaft.Application.Queries/ProductQueries.cs +++ b/Sheaft.Application.Queries/ProductQueries.cs @@ -38,7 +38,7 @@ public async Task SearchAsync(SearchTermsInput terms, Request SearchMode = SearchMode.Any, Top = terms.Take, Skip = (terms.Page - 1) * terms.Take, - SearchFields = new List { "partialProductName" }, + SearchFields = new List { "partialProductName", "partialProducerName" }, Select = new List() { "product_id", "product_name", "product_onSalePricePerUnit", "product_onSalePrice", "product_rating", "product_ratings_count", "product_image", "product_tags", "producer_id", "producer_name", "producer_email", "producer_phone", "producer_zipcode", "producer_city", "producer_longitude", "producer_latitude", "product_returnable", "product_unit", "product_quantityPerUnit", "product_conditioning", "product_available" diff --git a/Sheaft.Infrastructure.Persistence/Data/init.txt b/Sheaft.Infrastructure.Persistence/Data/init.txt index d28712235..e993ea4ff 100644 --- a/Sheaft.Infrastructure.Persistence/Data/init.txt +++ b/Sheaft.Infrastructure.Persistence/Data/init.txt @@ -604,7 +604,7 @@ migrationBuilder.Sql("CREATE VIEW [app].StoresPerDepartment AS select DepartmentId, DepartmentCode, DepartmentName, RegionId, RegionCode, RegionName, sum(Active) AS Active, sum(Created) as Created from ( select d.Id as DepartmentId, d.Code as DepartmentCode, d.Name as DepartmentName, r.Id as RegionId, r.Code as RegionCode, r.Name as RegionName, case when count(p.Uid) > 0 then 1 else 0 end as Active, count(distinct(c.Uid)) as Created from app.Departments d join app.Regions r on r.Uid = d.RegionUid left join app.UserAddresses ca on d.Uid = ca.DepartmentUid left join app.Users c on c.Uid = ca.UserUid and c.Kind = 1 left join app.Products p on c.Uid = p.ProducerUid group by c.Kind, d.Id, d.Code, d.Name, r.Id, r.Code, r.Name, c.RemovedOn ) cc group by DepartmentId, DepartmentCode, DepartmentName, RegionId, RegionCode, RegionName"); migrationBuilder.Sql("CREATE VIEW [app].ProducersSearch as select r.Id as producer_id , r.Name as producer_name , r.Name as partialProducerName , r.Email as producer_email , r.Picture as producer_picture , r.Phone as producer_phone , ra.Line1 as producer_line1 , ra.Line2 as producer_line2 , ra.Zipcode as producer_zipcode , ra.City as producer_city , app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)) as last_update , case when r.RemovedOn is null then 0 else 1 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as producer_tags , ra.Longitude as producer_longitude , ra.Latitude as producer_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as producer_geolocation , count(p.Id) as producer_products_count from app.Users r join app.UserAddresses ra on r.Uid = ra.UserUid left join app.ProducerTags ct on r.Uid = ct.ProducerUid left join app.Tags t on t.Uid = ct.TagUid left join app.Products p on p.ProducerUid = r.Uid where r.Kind = 0 and r.OpenForNewBusiness = 1 group by r.Id, r.Name, r.Email, r.Picture, r.Phone, ra.Line1, ra.Line2, ra.Zipcode, ra.City, app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)), case when r.RemovedOn is null then 0 else 1 end, ra.Longitude, ra.Latitude"); - migrationBuilder.Sql("CREATE VIEW [app].ProductsSearch as select p.Id as product_id , p.Name as product_name , p.Name as partialProductName , CAST(p.QuantityPerUnit as float) as product_quantityPerUnit , case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end as product_unit , CAST(p.OnSalePricePerUnit as float) as product_onSalePricePerUnit , CAST(p.OnSalePrice as float) as product_onSalePrice , CAST(p.Rating as float) as product_rating , p.RatingsCount as product_ratings_count , case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end as product_returnable , r.Id as producer_id , r.Name as producer_name , r.Email as producer_email , r.Phone as producer_phone , ra.Zipcode as producer_zipcode , ra.City as producer_city , p.Picture as product_image , p.Available as product_available , p.VisibleToConsumers as product_searchable , case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end as product_conditioning , app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn) as last_update , case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as product_tags , ra.Longitude as producer_longitude , ra.Latitude as producer_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as producer_geolocation from app.Products p join app.Users r on r.Uid = p.ProducerUid and r.Kind = 0 join app.UserAddresses ra on r.Uid = ra.UserUid left join app.ProductTags pt on p.Uid = pt.ProductUid left join app.Returnables pa on pa.Uid = p.ReturnableUid left join app.Tags t on t.Uid = pt.TagUid group by p.Id, p.Name, case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end, CAST(p.QuantityPerUnit as float), CAST(p.OnSalePricePerUnit as float), CAST(p.OnSalePrice as float), CAST(p.WholeSalePrice as float), CAST(p.Rating as float), p.RatingsCount, case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end, r.Id, r.Name, r.Email, p.Picture, case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end, r.Id, r.Phone, p.Available, p.VisibleToConsumers, ra.Zipcode, ra.City, app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn), case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end, ra.Longitude, ra.Latitude"); + migrationBuilder.Sql("CREATE VIEW [app].ProductsSearch as select p.Id as product_id , p.Name as product_name , p.Name as partialProductName , CAST(p.QuantityPerUnit as float) as product_quantityPerUnit , case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end as product_unit , CAST(p.OnSalePricePerUnit as float) as product_onSalePricePerUnit , CAST(p.OnSalePrice as float) as product_onSalePrice , CAST(p.Rating as float) as product_rating , p.RatingsCount as product_ratings_count , case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end as product_returnable , r.Id as producer_id , r.Name as producer_name, r.Name as partialProducerName , r.Email as producer_email , r.Phone as producer_phone , ra.Zipcode as producer_zipcode , ra.City as producer_city , p.Picture as product_image , p.Available as product_available , p.VisibleToConsumers as product_searchable , case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end as product_conditioning , app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn) as last_update , case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as product_tags , ra.Longitude as producer_longitude , ra.Latitude as producer_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as producer_geolocation from app.Products p join app.Users r on r.Uid = p.ProducerUid and r.Kind = 0 join app.UserAddresses ra on r.Uid = ra.UserUid left join app.ProductTags pt on p.Uid = pt.ProductUid left join app.Returnables pa on pa.Uid = p.ReturnableUid left join app.Tags t on t.Uid = pt.TagUid group by p.Id, p.Name, case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end, CAST(p.QuantityPerUnit as float), CAST(p.OnSalePricePerUnit as float), CAST(p.OnSalePrice as float), CAST(p.WholeSalePrice as float), CAST(p.Rating as float), p.RatingsCount, case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end, r.Id, r.Name, r.Email, p.Picture, case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end, r.Id, r.Phone, p.Available, p.VisibleToConsumers, ra.Zipcode, ra.City, app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn), case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end, ra.Longitude, ra.Latitude"); migrationBuilder.Sql("CREATE VIEW [app].StoresSearch as select r.Id as store_id , r.Name as store_name , r.Name as partialStoreName , r.Email as store_email , r.Picture as store_picture , r.Phone as store_phone , ra.Line1 as store_line1 , ra.Line2 as store_line2 , ra.Zipcode as store_zipcode , ra.City as store_city , app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)) as last_update , case when r.RemovedOn is null then 0 else 1 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as store_tags , ra.Longitude as store_longitude , ra.Latitude as store_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as store_geolocation from app.Users r join app.UserAddresses ra on r.Uid = ra.UserUid left join app.StoreTags ct on r.Uid = ct.StoreUid left join app.Tags t on t.Uid = ct.TagUid where r.Kind = 1 and r.OpenForNewBusiness = 1 group by r.Id, r.Name, r.Email, r.Picture, r.Phone, ra.Line1, ra.Line2, ra.Zipcode, ra.City, app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)), case when r.RemovedOn is null then 0 else 1 end, ra.Longitude, ra.Latitude"); migrationBuilder.Sql("CREATE SCHEMA [Cache]"); diff --git a/Sheaft.Infrastructure.Persistence/Indexes/azsearch_index_products.json b/Sheaft.Infrastructure.Persistence/Indexes/azsearch_index_products.json index 43814f704..bbb8b2e82 100644 --- a/Sheaft.Infrastructure.Persistence/Indexes/azsearch_index_products.json +++ b/Sheaft.Infrastructure.Persistence/Indexes/azsearch_index_products.json @@ -294,6 +294,21 @@ POST https://sheaft-search.search.windows.net/indexes?api-version=2020-06-30&all "synonymMaps": [], "fields": [] }, + { + "name": "partialProducerName", + "type": "Edm.String", + "facetable": false, + "filterable": false, + "key": false, + "retrievable": false, + "searchable": true, + "sortable": false, + "analyzer": null, + "indexAnalyzer": "prefixCmAnalyzer", + "searchAnalyzer": "standardCmAnalyzer", + "synonymMaps": [], + "fields": [] + }, { "name": "packaging_name", "type": "Edm.String", diff --git a/Sheaft.Infrastructure.Persistence/Migrations/20201030160301_InitDatabase.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201030160301_InitDatabase.cs index ac68a206b..8661d78c8 100644 --- a/Sheaft.Infrastructure.Persistence/Migrations/20201030160301_InitDatabase.cs +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201030160301_InitDatabase.cs @@ -3064,7 +3064,7 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.Sql("CREATE VIEW [app].StoresPerDepartment AS select DepartmentId, DepartmentCode, DepartmentName, RegionId, RegionCode, RegionName, sum(Active) AS Active, sum(Created) as Created from ( select d.Id as DepartmentId, d.Code as DepartmentCode, d.Name as DepartmentName, r.Id as RegionId, r.Code as RegionCode, r.Name as RegionName, case when count(p.Uid) > 0 then 1 else 0 end as Active, count(distinct(c.Uid)) as Created from app.Departments d join app.Regions r on r.Uid = d.RegionUid left join app.UserAddresses ca on d.Uid = ca.DepartmentUid left join app.Users c on c.Uid = ca.UserUid and c.Kind = 1 left join app.Products p on c.Uid = p.ProducerUid group by c.Kind, d.Id, d.Code, d.Name, r.Id, r.Code, r.Name, c.RemovedOn ) cc group by DepartmentId, DepartmentCode, DepartmentName, RegionId, RegionCode, RegionName"); migrationBuilder.Sql("CREATE VIEW [app].ProducersSearch as select r.Id as producer_id , r.Name as producer_name , r.Name as partialProducerName , r.Email as producer_email , r.Picture as producer_picture , r.Phone as producer_phone , ra.Line1 as producer_line1 , ra.Line2 as producer_line2 , ra.Zipcode as producer_zipcode , ra.City as producer_city , app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)) as last_update , case when r.RemovedOn is null then 0 else 1 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as producer_tags , ra.Longitude as producer_longitude , ra.Latitude as producer_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as producer_geolocation , count(p.Id) as producer_products_count from app.Users r join app.UserAddresses ra on r.Uid = ra.UserUid left join app.ProducerTags ct on r.Uid = ct.ProducerUid left join app.Tags t on t.Uid = ct.TagUid left join app.Products p on p.ProducerUid = r.Uid where r.Kind = 0 and r.OpenForNewBusiness = 1 group by r.Id, r.Name, r.Email, r.Picture, r.Phone, ra.Line1, ra.Line2, ra.Zipcode, ra.City, app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)), case when r.RemovedOn is null then 0 else 1 end, ra.Longitude, ra.Latitude"); - migrationBuilder.Sql("CREATE VIEW [app].ProductsSearch as select p.Id as product_id , p.Name as product_name , p.Name as partialProductName , CAST(p.QuantityPerUnit as float) as product_quantityPerUnit , case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end as product_unit , CAST(p.OnSalePricePerUnit as float) as product_onSalePricePerUnit , CAST(p.OnSalePrice as float) as product_onSalePrice , CAST(p.Rating as float) as product_rating , p.RatingsCount as product_ratings_count , case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end as product_returnable , r.Id as producer_id , r.Name as producer_name , r.Email as producer_email , r.Phone as producer_phone , ra.Zipcode as producer_zipcode , ra.City as producer_city , p.Picture as product_image , p.Available as product_available , p.VisibleToConsumers as product_searchable , case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end as product_conditioning , app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn) as last_update , case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as product_tags , ra.Longitude as producer_longitude , ra.Latitude as producer_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as producer_geolocation from app.Products p join app.Users r on r.Uid = p.ProducerUid and r.Kind = 0 join app.UserAddresses ra on r.Uid = ra.UserUid left join app.ProductTags pt on p.Uid = pt.ProductUid left join app.Returnables pa on pa.Uid = p.ReturnableUid left join app.Tags t on t.Uid = pt.TagUid group by p.Id, p.Name, case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end, CAST(p.QuantityPerUnit as float), CAST(p.OnSalePricePerUnit as float), CAST(p.OnSalePrice as float), CAST(p.WholeSalePrice as float), CAST(p.Rating as float), p.RatingsCount, case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end, r.Id, r.Name, r.Email, p.Picture, case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end, r.Id, r.Phone, p.Available, p.VisibleToConsumers, ra.Zipcode, ra.City, app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn), case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end, ra.Longitude, ra.Latitude"); + migrationBuilder.Sql("CREATE VIEW [app].ProductsSearch as select p.Id as product_id , p.Name as product_name , p.Name as partialProductName , CAST(p.QuantityPerUnit as float) as product_quantityPerUnit , case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end as product_unit , CAST(p.OnSalePricePerUnit as float) as product_onSalePricePerUnit , CAST(p.OnSalePrice as float) as product_onSalePrice , CAST(p.Rating as float) as product_rating , p.RatingsCount as product_ratings_count , case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end as product_returnable , r.Id as producer_id , r.Name as producer_name, r.Name as partialProducerName , r.Email as producer_email , r.Phone as producer_phone , ra.Zipcode as producer_zipcode , ra.City as producer_city , p.Picture as product_image , p.Available as product_available , p.VisibleToConsumers as product_searchable , case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end as product_conditioning , app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn) as last_update , case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as product_tags , ra.Longitude as producer_longitude , ra.Latitude as producer_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as producer_geolocation from app.Products p join app.Users r on r.Uid = p.ProducerUid and r.Kind = 0 join app.UserAddresses ra on r.Uid = ra.UserUid left join app.ProductTags pt on p.Uid = pt.ProductUid left join app.Returnables pa on pa.Uid = p.ReturnableUid left join app.Tags t on t.Uid = pt.TagUid group by p.Id, p.Name, case when p.Unit = 1 then 'mL' when p.Unit = 2 then 'L' when p.Unit = 3 then 'g' when p.Unit = 4 then 'kg' end, CAST(p.QuantityPerUnit as float), CAST(p.OnSalePricePerUnit as float), CAST(p.OnSalePrice as float), CAST(p.WholeSalePrice as float), CAST(p.Rating as float), p.RatingsCount, case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end, r.Id, r.Name, r.Email, p.Picture, case when p.Conditioning = 1 then 'BOX' when p.Conditioning = 2 then 'BULK' when p.Conditioning = 3 then 'BOUQUET' when p.Conditioning = 4 then 'BUNCH' when p.Conditioning = 5 then 'PIECE' when p.Conditioning = 6 then 'BASKET' end, r.Id, r.Phone, p.Available, p.VisibleToConsumers, ra.Zipcode, ra.City, app.InlineMax(app.InlineMax(app.InlineMax(p.UpdatedOn, r.UpdatedOn), t.UpdatedOn), p.CreatedOn), case when (app.InlineMax(p.RemovedOn, r.RemovedOn)) is not null or r.CanDirectSell = 0 then 1 else 0 end, ra.Longitude, ra.Latitude"); migrationBuilder.Sql("CREATE VIEW [app].StoresSearch as select r.Id as store_id , r.Name as store_name , r.Name as partialStoreName , r.Email as store_email , r.Picture as store_picture , r.Phone as store_phone , ra.Line1 as store_line1 , ra.Line2 as store_line2 , ra.Zipcode as store_zipcode , ra.City as store_city , app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)) as last_update , case when r.RemovedOn is null then 0 else 1 end as removed , '[' + STRING_AGG('\"' + LOWER(t.Name) + '\"', ',') + ']' as store_tags , ra.Longitude as store_longitude , ra.Latitude as store_latitude , geography::STGeomFromText('POINT('+convert(varchar(20),ra.Longitude)+' '+convert(varchar(20),ra.Latitude)+')',4326) as store_geolocation from app.Users r join app.UserAddresses ra on r.Uid = ra.UserUid left join app.StoreTags ct on r.Uid = ct.StoreUid left join app.Tags t on t.Uid = ct.TagUid where r.Kind = 1 and r.OpenForNewBusiness = 1 group by r.Id, r.Name, r.Email, r.Picture, r.Phone, ra.Line1, ra.Line2, ra.Zipcode, ra.City, app.InlineMax(r.CreatedOn, app.InlineMax(r.UpdatedOn, t.UpdatedOn)), case when r.RemovedOn is null then 0 else 1 end, ra.Longitude, ra.Latitude"); migrationBuilder.Sql("CREATE SCHEMA [Cache]"); diff --git a/Sheaft.Infrastructure.Persistence/Scripts/view_productsSearch.sql b/Sheaft.Infrastructure.Persistence/Scripts/view_productsSearch.sql index f22861362..bc8bf742c 100644 --- a/Sheaft.Infrastructure.Persistence/Scripts/view_productsSearch.sql +++ b/Sheaft.Infrastructure.Persistence/Scripts/view_productsSearch.sql @@ -26,6 +26,7 @@ as , case when pa.Uid is not null then cast(1 as bit) else cast(0 as bit) end as product_returnable , r.Id as producer_id , r.Name as producer_name + , r.Name as partialProducerName , r.Email as producer_email , r.Phone as producer_phone , ra.Zipcode as producer_zipcode