Compare commits
4 Commits
f23552a000
...
a8ec0cee16
Author | SHA1 | Date | |
---|---|---|---|
|
a8ec0cee16 | ||
|
33f88a3f62 | ||
|
bdf5f4f727 | ||
|
b7e4bf6887 |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
[Dd]eploy/
|
@ -28,7 +28,7 @@ namespace RhSolutions.Api.Controllers
|
|||||||
public IEnumerable<Product> GetProduct(string id)
|
public IEnumerable<Product> GetProduct(string id)
|
||||||
{
|
{
|
||||||
return dbContext.Products
|
return dbContext.Products
|
||||||
.Where(p => p.ProductSku!.Equals(id));
|
.Where(p => p.Id.Equals(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -4,24 +4,25 @@ using RhSolutions.Models;
|
|||||||
|
|
||||||
namespace RhSolutions.Api.Controllers
|
namespace RhSolutions.Api.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class SearchController : ControllerBase
|
public class SearchController : ControllerBase
|
||||||
{
|
{
|
||||||
private RhSolutionsContext context;
|
private RhSolutionsContext context;
|
||||||
|
|
||||||
public SearchController(RhSolutionsContext context)
|
public SearchController(RhSolutionsContext context)
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IAsyncEnumerable<Product> SearchProducts([FromQuery] string query)
|
public IAsyncEnumerable<Product> SearchProducts([FromQuery] string query)
|
||||||
{
|
{
|
||||||
return context.Products
|
return context.Products
|
||||||
.Where(p => EF.Functions.ToTsVector(
|
.Where(p => EF.Functions.ToTsVector(
|
||||||
"russian", string.Join(' ', new[] { p.Name, string.Join(' ', p.ProductLines)}))
|
"russian", string.Join(' ', new[] { p.Name, string.Join(' ', p.ProductLines)}))
|
||||||
.Matches(EF.Functions.WebSearchToTsQuery("russian", query)))
|
.Matches(EF.Functions.WebSearchToTsQuery("russian", query)))
|
||||||
.AsAsyncEnumerable();
|
.OrderByDescending(p => p.IsOnWarehouse)
|
||||||
}
|
.AsAsyncEnumerable();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ClosedXML" Version="0.101.0" />
|
<PackageReference Include="ClosedXML" Version="0.100.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user