adjustments
rename search subscriber fix: comments in medusa-interfaces/search-service.js add: use cursor pagination when indexing all products to search engine fix: emit product_id on product-variant creation fix: move search API route under products/search fix: use meilisearchService instead of searchService in plugin loader
This commit is contained in:
@@ -15,7 +15,6 @@ import returnReasonRoutes from "./return-reasons"
|
||||
import swapRoutes from "./swaps"
|
||||
import variantRoutes from "./variants"
|
||||
import giftCardRoutes from "./gift-cards"
|
||||
import searchRoutes from "./search"
|
||||
|
||||
const route = Router()
|
||||
|
||||
@@ -44,7 +43,6 @@ export default (app, container, config) => {
|
||||
returnRoutes(route)
|
||||
giftCardRoutes(route)
|
||||
returnReasonRoutes(route)
|
||||
searchRoutes(route)
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ export default app => {
|
||||
app.use("/products", route)
|
||||
|
||||
route.get("/", middlewares.wrap(require("./list-products").default))
|
||||
route.post("/search", middlewares.wrap(require("./search").default))
|
||||
route.get("/:id", middlewares.wrap(require("./get-product").default))
|
||||
|
||||
return app
|
||||
|
||||
+2
-3
@@ -1,11 +1,10 @@
|
||||
import { Validator, MedusaError } from "medusa-core-utils"
|
||||
import { INDEX_NS } from "../../../../utils/index-ns"
|
||||
import ProductService from "../../../../services/product"
|
||||
|
||||
export default async (req, res) => {
|
||||
const schema = Validator.object()
|
||||
.keys({
|
||||
q: Validator.string().required(),
|
||||
indexName: Validator.string().required(),
|
||||
})
|
||||
.options({ allowUnknown: true })
|
||||
|
||||
@@ -20,7 +19,7 @@ export default async (req, res) => {
|
||||
const searchService = req.scope.resolve("searchService")
|
||||
|
||||
const results = await searchService.search(
|
||||
`${INDEX_NS}_${indexName}`,
|
||||
ProductService.IndexName,
|
||||
q,
|
||||
options
|
||||
)
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Router } from "express"
|
||||
import middlewares from "../../../middlewares"
|
||||
|
||||
const route = Router()
|
||||
|
||||
export default app => {
|
||||
app.use("/search", route)
|
||||
|
||||
route.post("/", middlewares.wrap(require("./search").default))
|
||||
|
||||
return app
|
||||
}
|
||||
Reference in New Issue
Block a user