Open mslabko opened 4 years ago
Hi @mslabko. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
New GQL schema which should be supported
type Price {
amount: Float,
currency: String
}
type ProductItem {
id: ID
sku: String
url: String
imageUrl: String
price: Price
name: String
}
# If from or to fields are omitted, $gte or $lte filter will be applied
input SearchRangeInput {
from: Float
to: Float
}
input SearchClauseInput {
attribute: String!
# an array of values to filter on
in: [String]
# a string to filter on
eq: String
# range to filter on
range: SearchRangeInput
}
# This enumeration indicates whether to return results in ascending or descending order
enum SortEnum {
ASC
DESC
}
input ProductSearchSortInput {
attribute: String!
direction: SortEnum!
}
type SearchResultPageInfo {
# Specifies which page of results to return
currentPage: Int
# Specifies the maximum number of items to return
pageSize: Int
# Total pages
totalPages: Int
}
interface Bucket {
#Human readable bucket title
title: String!
}
type StatsBucket implements Bucket {
title: String!
min: Float!
max: Float!
}
type ScalarBucket implements Bucket {
title: String!
#Could be used for filtering and may contain non-human readable data
id: ID!
count: Int!
}
type RangeBucket implements Bucket {
title: String!
from: Float!
to: Float!
count: Int!
}
type Aggregation {
title: String!
attribute: String!
buckets: [Bucket]!
}
type Highlight {
attribute: String!
value: String!
matchedWords: [String]!
}
type ProductSearchItem {
product: ProductItem!
highlights: [Highlight]
}
type ProductSearchResponse {
totalCount: Int
items: [ProductSearchItem]
facets: [Aggregation]
suggestions: [String] # Should be ignored, available only for "Live Search"
relatedTerms: [String] # Should be ignored, available only for "Live Search"
pageInfo: SearchResultPageInfo
}
type Query {
productSearch(phrase: String!,
pageSize: Int = 20,
currentPage: Int = 1,
filter: [SearchClauseInput!],
# One or more sortings are applied to the same results.
sort: [ProductSearchSortInput!]): ProductSearchResponse!
notImplemented(searchRangeInput: SearchRangeInput):Bucket
scalarBucket: ScalarBucket
statsBucket: StatsBucket
rangeBucket: RangeBucket
}
# Only a single graphql file (in the project) should have schema definition.
# other graphql files must not have schema definition.
schema {
query: Query
}
@magento I am working on this
Hi @lykhachov! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team
command to join Contributors team.
As a Headless Magento Commerce Customer,
I would like to search the entire catalog for products or limit the search on selected filters
So that
I can get to the products I want in a fast and efficient manner.
Acceptance Criteria
The existing graphql schema is preserved and all filters and aggregations are supported.
The new Search graphql schema is also supported by the search service.
Graphql supports full-text search and the search response supports pagination and sorting.
Search results must return aggregations if requested by the user.
Search results can be refined further by specifying one or more filers.
Static tests which verify that we don’t have prohibited dependencies from storefront to monolith and vice versa.
Storefront services should be compatible with SaaS, which means that they might be easily substituted with SaaS services later, or they might communicate with SaaS services instead of Magento SF services.
That compatibility assumably should be implemented based on the Storefront API level, so that Storefront API should be compatible with RPC.
Implementation details
For the 1st Phase as a "transition" solution was decided to go with the following approach:
Search Service may be a simple wrapper on \Magento\Framework\Api\Search\SearchInterface::search to simplify implementation