From 427f32677e8288e9b9c6e53851e90bf5a88af54a Mon Sep 17 00:00:00 2001 From: PhoenixDev - YB Date: Tue, 11 Sep 2018 14:58:39 +0300 Subject: [PATCH 1/3] MTH-250 add min_score for text search --- config/default.json | 1 + src/graphql/elasticsearch/queryBuilder.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/default.json b/config/default.json index 7a2cab8a..606dcd67 100644 --- a/config/default.json +++ b/config/default.json @@ -9,6 +9,7 @@ "port": 9200, "user": "elastic", "password": "changeme", + "min_score": 0.01, "indices": [ "vue_storefront_catalog", "vue_storefront_catalog_de", diff --git a/src/graphql/elasticsearch/queryBuilder.js b/src/graphql/elasticsearch/queryBuilder.js index e3ac1d4d..ce74c2f6 100644 --- a/src/graphql/elasticsearch/queryBuilder.js +++ b/src/graphql/elasticsearch/queryBuilder.js @@ -2,6 +2,7 @@ import bodybuilder from 'bodybuilder'; import getBoosts from '../../lib/boost' import map from 'lodash/map'; import getMapping from './mapping' +import config from 'config' function processNestedFieldFilter(attribute, value) { let processedFilter = { @@ -171,5 +172,10 @@ export function buildQuery({ query = query.from((currentPage - 1) * pageSize).size(pageSize); - return query.build(); + let builtQuery = query.build() + if (search != '') { + builtQuery['min_score'] = config.elasticsearch.min_score + } + + return builtQuery; } From a0e5e2786fb9fe8c70e5ac075cefe45bd70045ab Mon Sep 17 00:00:00 2001 From: PhoenixDev - YB Date: Tue, 11 Sep 2018 17:51:14 +0300 Subject: [PATCH 2/3] Revert "MTH-250 Semknox resolver base" This reverts commit 0c64d73652e1d03fd4002040f6815a1c030f5d5e. --- src/graphql/semknox/attribute/resolver.js | 2 - src/graphql/semknox/attribute/schema.graphqls | 20 -- src/graphql/semknox/catalog/processor.js | 22 --- src/graphql/semknox/catalog/resolver.js | 119 ------------ src/graphql/semknox/catalog/schema.graphqls | 181 ------------------ src/graphql/semknox/category/resolver.js | 2 - src/graphql/semknox/category/schema.graphqls | 61 ------ src/graphql/semknox/client.js | 2 - src/graphql/semknox/json_type/resolver.js | 2 - src/graphql/semknox/queryBuilder.js | 2 - src/graphql/semknox/taxrule/resolver.js | 2 - src/graphql/semknox/taxrule/schema.graphqls | 15 -- 12 files changed, 430 deletions(-) delete mode 100644 src/graphql/semknox/attribute/resolver.js delete mode 100644 src/graphql/semknox/attribute/schema.graphqls delete mode 100755 src/graphql/semknox/catalog/processor.js delete mode 100644 src/graphql/semknox/catalog/resolver.js delete mode 100644 src/graphql/semknox/catalog/schema.graphqls delete mode 100644 src/graphql/semknox/category/resolver.js delete mode 100644 src/graphql/semknox/category/schema.graphqls delete mode 100644 src/graphql/semknox/client.js delete mode 100644 src/graphql/semknox/json_type/resolver.js delete mode 100644 src/graphql/semknox/queryBuilder.js delete mode 100644 src/graphql/semknox/taxrule/resolver.js delete mode 100644 src/graphql/semknox/taxrule/schema.graphqls diff --git a/src/graphql/semknox/attribute/resolver.js b/src/graphql/semknox/attribute/resolver.js deleted file mode 100644 index 16e07793..00000000 --- a/src/graphql/semknox/attribute/resolver.js +++ /dev/null @@ -1,2 +0,0 @@ -import resolver from '../../elasticsearch/attribute/resolver.js'; -export default resolver \ No newline at end of file diff --git a/src/graphql/semknox/attribute/schema.graphqls b/src/graphql/semknox/attribute/schema.graphqls deleted file mode 100644 index bb534af9..00000000 --- a/src/graphql/semknox/attribute/schema.graphqls +++ /dev/null @@ -1,20 +0,0 @@ -type Query { - customAttributeMetadata(attributes: AttributeInput!): ESResponse -} - -type CustomAttributeMetadata @doc(description: "CustomAttributeMetadata defines an array of attribute_codes and entity_types") { - items: [Attribute] @doc(description: "An array of attributes") -} - -type Attribute @doc(description: "Attribute contains the attribute_type of the specified attribute_code and entity_type") { - attribute_code: String @doc(description: "The unique identifier for an attribute code. This value should be in lowercase letters without spaces.") - entity_type: String @doc(description: "The type of entity that defines the attribute") - attribute_type: String @doc(description: "The data type of the attribute") -} - -input AttributeInput @doc(description: "AttributeInput specifies the attribute_code and entity_type to search") { - attribute_code: FilterTypeInput @doc(description: "The unique identifier for an attribute code. This value should be in lowercase letters without spaces.") - entity_type: String @doc(description: "The type of entity that defines the attribute") - attribute_id: FilterTypeInput @doc(description: "The id of attribute. This value should be in lowercase letters without spaces.") - is_user_defined: FilterTypeInput @doc(description: "THe attribute is user defined parameter.") -} diff --git a/src/graphql/semknox/catalog/processor.js b/src/graphql/semknox/catalog/processor.js deleted file mode 100755 index 9c480386..00000000 --- a/src/graphql/semknox/catalog/processor.js +++ /dev/null @@ -1,22 +0,0 @@ -import config from 'config' -import ProcessorFactory from '../../../processor/factory' - -export default function esResultsProcessor(response, entityType, indexName) { - return new Promise((resolve, reject) => { - const factory = new ProcessorFactory(config) - let resultProcessor = factory.getAdapter(entityType, indexName) - - if (!resultProcessor) { - resultProcessor = factory.getAdapter('default', indexName) // get the default processor - } - - resultProcessor.process(response.hits.hits) - .then((result) => { - resolve(result) - }) - .catch((err) => { - console.error(err) - }) - }) -} - diff --git a/src/graphql/semknox/catalog/resolver.js b/src/graphql/semknox/catalog/resolver.js deleted file mode 100644 index 2bc20eac..00000000 --- a/src/graphql/semknox/catalog/resolver.js +++ /dev/null @@ -1,119 +0,0 @@ -import config from 'config'; -import client from '../client'; -import { buildQuery } from '../queryBuilder'; -import esResultsProcessor from './processor' - -const resolver = { - Query: { - products: (_, { search, filter, sort, currentPage, pageSize }, context, rootValue) => - list(filter, sort, currentPage, pageSize, search, context, rootValue) - } -}; - -async function list(filter, sort, currentPage, pageSize, search, context, rootValue) { - let query = buildQuery({ - filter: filter, - sort: sort, - currentPage: currentPage, - pageSize: pageSize, - search: search, - includeFields: config.entities.productListWithChildren.includeFields, - excludeFields: config.entities.productListWithChildren.excludeFields, - type: 'product' - }); - - const parseURL = context.req.url.replace(/^\/+|\/+$/g, ''); - let urlParts = parseURL.split('/'); - let esIndex = config.elasticsearch.indices[0] - - if (urlParts.length >= 1 && urlParts[0] != '') { - esIndex = config.storeViews[urlParts[0]].elasticsearch.index - } - - let esResponse = await client.search({ - index: esIndex, - type: config.elasticsearch.indexTypes[0], - body: query - }); - - if (esResponse && esResponse.hits && esResponse.hits.hits) { - // process response result (caluclate taxes etc...) - esResponse.hits.hits = await esResultsProcessor(esResponse, config.elasticsearch.indexTypes[0], esIndex); - } - - let response = {} - - // Process hits - response.items = [] - esResponse.hits.hits.forEach(hit => { - let item = hit._source - item._score = hit._score - response.items.push(item) - }); - - response.total_count = esResponse.hits.total - - // Convert aggregations to filters - // response.filters = prepareFiltersByAggregations(esResponse.aggregations, filter) - - // Process sort - let sortOptions = [] - for (var sortAttribute in sort){ - sortOptions.push( - { - label: sortAttribute, - value: sortAttribute - } - ) - } - - response.aggregations = esResponse.aggregations - response.sort_fields = {} - if (sortOptions.length > 0) { - response.sort_fields.options = sortOptions - } - - response.page_info = { - page_size: pageSize, - current_page: currentPage - } - - return response; -} - -/* -* Convert Aggregations to the Filters type provided by Magento graphQl EAV schema -* -* @TODO need to check if we can switch to using Filters intsead of Aggregation in the response -* following by Magento Products response type and finihs convertions -*/ -function prepareFiltersByAggregations(aggregations, filter) { - console.log('filter', filter); - let filters = {} - for (var aggregation in aggregations){ - for (var attrToFilter in filter){ - // console.log('incomeFilter', attrToFilter); - if (aggregation == 'agg_terms_' + attrToFilter) { - const aggregationData = aggregations[aggregation] - if (typeof aggregationData !== 'function') { - // console.log('aggregation', aggregation); - // console.log('aggregationData terms', aggregationData); - let aggFilter = {} - aggFilter.name = aggregation - } - } - if (aggregation == 'agg_range_' + attrToFilter) { - const aggregationData = aggregations[aggregation] - if (typeof aggregationData !== 'function') { - // console.log('aggregation', aggregation); - // console.log('aggregationData range', aggregationData); - let aggFilter = {} - aggFilter.name = aggregation - } - } - } - } - return filters -} - -export default resolver; diff --git a/src/graphql/semknox/catalog/schema.graphqls b/src/graphql/semknox/catalog/schema.graphqls deleted file mode 100644 index be409767..00000000 --- a/src/graphql/semknox/catalog/schema.graphqls +++ /dev/null @@ -1,181 +0,0 @@ -scalar JSON - -type Products @doc(description: "The Products object is the top-level object returned in a product search") { - items: JSON @doc(description: "An array of products that match the specified search criteria") - # items: [ProductInterface] // @TODO: update items to use [ProductInterface] type - page_info: SearchResultPageInfo @doc(description: "An object that includes the page_info and currentPage values specified in the query") - total_count: Int @doc(description: "The number of products returned") - # filters: [LayerFilter] @doc(description: "Layered navigation filters array") // @TODO: add filters to response instead of aggregations - aggregations: JSON @doc(description: "Layered navigation filters array as aggregations") - sort_fields: SortFields @doc(description: "An object that includes the default sort field and all available sort fields") -} - -type ESResponse { - hits: JSON - suggest: JSON - aggregations: JSON -} - -type Query { - products ( - search: String @doc(description: "Performs a full-text search using the specified key words."), - filter: ProductFilterInput @doc(description: "Identifies which product attributes to search for and return."), - pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."), - currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1."), - sort: ProductSortInput @doc(description: "Specifies which attribute to sort on, and whether to return the results in ascending or descending order.") - ): Products -} - -type SearchResultPageInfo @doc(description: "SearchResultPageInfo provides navigation for the query response") { - page_size: Int @doc(description: "Specifies the maximum number of items to return") - current_page: Int @doc(description: "Specifies which page of results to return") -} - -input FilterTypeInput @doc(description: "FilterTypeInput specifies which action will be performed in a query ") { - eq: JSON @doc(description: "Equals") - finset: [String] @doc(description: "Find in set. The value can contain a set of comma-separated values") - from: String @doc(description: "From. Must be used with 'to'") - gt: String @doc(description: "Greater than") - gte: String @doc(description: "Greater than or equal to") - gteq: String @doc(description: "Greater than or equal to") - in: [JSON] @doc(description: "In. The value can contain a set of comma-separated values") - like: String @doc(description: "Like. The specified value can contain % (percent signs) to allow matching of 0 or more characters") - lt: String @doc(description: "Less than") - lte: String @doc(description: "Less than or equal to") - lteq: String @doc(description: "Less than or equal to") - moreq: String @doc(description: "More than or equal to") - neq: JSON @doc(description: "Not equal to") - notnull: String @doc(description: "Not null") - null: String @doc(description: "Is null") - to: String@doc(description: "To. Must be used with 'from'") - nin: [String] @doc(description: "Not in. The value can contain a set of comma-separated values") - scope: [String] @doc(description: "describe the filter scope (default | catalog)") -} - -input ProductSortInput { - name: SortEnum @doc(description: "The product name. Customers use this name to identify the product.") - sku: SortEnum @doc(description: "A number or code assigned to a product to identify the product, options, price, and manufacturer") - description: SortEnum @doc(description: "Detailed information about the product. The value can include simple HTML tags.") - short_description: SortEnum @doc(description: "A short description of the product. Its use depends on the theme.") - price: SortEnum @doc(description: "The price of the item") - special_price: SortEnum @doc(description: "The discounted price of the product") - special_from_date: SortEnum @doc(description: "The beginning date that a product has a special price") - special_to_date: SortEnum @doc(description: "The end date that a product has a special price") - weight: SortEnum @doc(description: "The weight of the item, in units defined by the store") - manufacturer: SortEnum @doc(description: "A number representing the product's manufacturer") - meta_title: SortEnum @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists") - meta_keyword: SortEnum @doc(description: "A comma-separated list of keywords that are visible only to search engines") - meta_description: SortEnum @doc(description: "A brief overview of the product for search results listings, maximum 255 characters") - image: SortEnum @doc(description: "The relative path to the main image on the product page") - small_image: SortEnum @doc(description: "The relative path to the small image, which is used on catalog pages") - thumbnail: SortEnum @doc(description: "The relative path to the product's thumbnail image") - tier_price: SortEnum @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached") - news_from_date: SortEnum @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product") - news_to_date: SortEnum @doc(description: "The end date for new product listings") - custom_layout_update: SortEnum @doc(description: "XML code that is applied as a layout update to the product page") - options_container: SortEnum @doc(description: "If the product has multiple options, determines where they appear on the product page") - required_options: SortEnum @doc(description: "Indicates whether the product has required options") - has_options: SortEnum @doc(description: "Indicates whether additional attributes have been created for the product") - image_label: SortEnum @doc(description: "The label assigned to a product image") - small_image_label: SortEnum @doc(description: "The label assigned to a product's small image") - thumbnail_label: SortEnum @doc(description: "The label assigned to a product's thumbnail image") - created_at: SortEnum @doc(description: "Timestamp indicating when the product was created") - updated_at: SortEnum @doc(description: "Timestamp indicating when the product was updated") - country_of_manufacture: SortEnum @doc(description: "The product's country of origin") - custom_layout: SortEnum @doc(description: "The name of a custom layout") - gift_message_available: SortEnum @doc(description: "Indicates whether a gift message is available") -} - -input ProductFilterInput @doc(description: "ProductFilterInput defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.") { - visibility: FilterTypeInput @doc(description: "The product visibility. Customers use this visibility to identify the product.") - status: FilterTypeInput @doc(description: "The product status. Customers use this status to identify the product.") - name: FilterTypeInput @doc(description: "The product name. Customers use this name to identify the product.") - sku: FilterTypeInput @doc(description: "A number or code assigned to a product to identify the product, options, price, and manufacturer") - description: FilterTypeInput @doc(description: "Detailed information about the product. The value can include simple HTML tags.") - short_description: FilterTypeInput @doc(description: "A short description of the product. Its use depends on the theme.") - price: FilterTypeInput @doc(description: "The price of an item") - special_price: FilterTypeInput @doc(description: "The discounted price of the product") - special_from_date: FilterTypeInput @doc(description: "The beginning date that a product has a special price") - special_to_date: FilterTypeInput @doc(description: "The end date that a product has a special price") - weight: FilterTypeInput @doc(description: "The weight of the item, in units defined by the store") - manufacturer: FilterTypeInput @doc(description: "A number representing the product's manufacturer") - meta_title: FilterTypeInput @doc(description: "A string that is displayed in the title bar and tab of the browser and in search results lists") - meta_keyword: FilterTypeInput @doc(description: "A comma-separated list of keywords that are visible only to search engines") - meta_description: FilterTypeInput @doc(description: "A brief overview of the product for search results listings, maximum 255 characters") - image: FilterTypeInput @doc(description: "The relative path to the main image on the product page") - small_image: FilterTypeInput @doc(description: "The relative path to the small image, which is used on catalog pages") - thumbnail: FilterTypeInput @doc(description: "The relative path to the product's thumbnail image") - tier_price: FilterTypeInput @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached") - news_from_date: FilterTypeInput @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product") - news_to_date: FilterTypeInput @doc(description: "The end date for new product listings") - custom_layout_update: FilterTypeInput @doc(description: "XML code that is applied as a layout update to the product page") - min_price: FilterTypeInput @doc(description:"The numeric minimal price of the product. Do not include the currency code.") - max_price: FilterTypeInput @doc(description:"The numeric maximal price of the product. Do not include the currency code.") - special_price: FilterTypeInput @doc(description:"The numeric special price of the product. Do not include the currency code.") - category_ids: FilterTypeInput @doc(description: "Category ID the product belongs to") - options_container: FilterTypeInput @doc(description: "If the product has multiple options, determines where they appear on the product page") - required_options: FilterTypeInput @doc(description: "Indicates whether the product has required options") - has_options: FilterTypeInput @doc(description: "Indicates whether additional attributes have been created for the product") - image_label: FilterTypeInput @doc(description: "The label assigned to a product image") - small_image_label: FilterTypeInput @doc(description: "The label assigned to a product's small image") - thumbnail_label: FilterTypeInput @doc(description: "The label assigned to a product's thumbnail image") - created_at: FilterTypeInput @doc(description: "Timestamp indicating when the product was created") - updated_at: FilterTypeInput @doc(description: "Timestamp indicating when the product was updated") - country_of_manufacture: FilterTypeInput @doc(description: "The product's country of origin") - custom_layout: FilterTypeInput @doc(description: "The name of a custom layout") - gift_message_available: FilterTypeInput @doc(description: "Indicates whether a gift message is available") - price: FilterTypeInput @doc(description: "The price of an item") - final_price: FilterTypeInput @doc(description: "The final price of an item") - special_price: FilterTypeInput @doc(description: "The discounted price of the product") - special_from_date: FilterTypeInput @doc(description: "The beginning date that a product has a special price") - special_to_date: FilterTypeInput @doc(description: "The end date that a product has a special price") - weight: FilterTypeInput @doc(description: "The weight of the item, in units defined by the store") - tier_price: FilterTypeInput @doc(description: "The price when tier pricing is in effect and the items purchased threshold has been reached") - news_from_date: FilterTypeInput @doc(description: "The beginning date for new product listings, and determines if the product is featured as a new product") - news_to_date: FilterTypeInput @doc(description: "The end date for new product listings") - min_price: FilterTypeInput @doc(description:"The numeric minimal price of the product. Do not include the currency code.") - max_price: FilterTypeInput @doc(description:"The numeric maximal price of the product. Do not include the currency code.") - special_price: FilterTypeInput @doc(description:"The numeric special price of the product. Do not include the currency code.") - created_at: FilterTypeInput @doc(description: "Timestamp indicating when the product was created") - updated_at: FilterTypeInput @doc(description: "Timestamp indicating when the product was updated") - erin_recommends: FilterTypeInput @doc(description: "The product erin_recommends. Customers use this erin_recommends to identify the product.") - size: FilterTypeInput @doc(description: "The product size. Customers use this size to identify the product.") - color: FilterTypeInput @doc(description: "The product color. Customers use this color to identify the product.") - or: ProductFilterInput @doc(description: "The keyword required to perform a logical OR comparison") - category: ProductFilterInput @doc(description: "The product color. Customers use this color to identify the product.") - category_id: FilterTypeInput @doc(description: "Category ID the product belongs to") - configurable_children: ProductFilterInput @doc(description: "Configurable product childrens") - stock: ProductFilterInput @doc(description: "The product stock. Customers use this stock to identify the product.") - is_in_stock: FilterTypeInput @doc(description: "Is product in stock") -} - -type LayerFilter { - name: String @doc(description: "Layered navigation filter name") - request_var: String @doc(description: "Request variable name for filter query") - filter_items_count: Int @doc(description: "Count of filter items in filter group") - filter_items: [LayerFilterItemInterface] @doc(description: "Array of filter items") -} - -interface LayerFilterItemInterface { - label: String @doc(description: "Filter label") - value_string: String @doc(description: "Value for filter request variable to be used in query") - items_count: Int @doc(description: "Count of items by filter") -} - -#type LayerFilterItem implements LayerFilterItemInterface { -#} - -type SortField { - value: String @doc(description: "Attribute code of sort field") - label: String @doc(description: "Label of sort field") -} - -type SortFields @doc(description: "SortFields contains a default value for sort fields and all available sort fields") { - default: String @doc(description: "Default value of sort fields") - options: [SortField] @doc(description: "Available sort fields") -} - -enum SortEnum { - ASC - DESC -} \ No newline at end of file diff --git a/src/graphql/semknox/category/resolver.js b/src/graphql/semknox/category/resolver.js deleted file mode 100644 index 5e1e093b..00000000 --- a/src/graphql/semknox/category/resolver.js +++ /dev/null @@ -1,2 +0,0 @@ -import resolver from '../../elasticsearch/category/resolver.js'; -export default resolver \ No newline at end of file diff --git a/src/graphql/semknox/category/schema.graphqls b/src/graphql/semknox/category/schema.graphqls deleted file mode 100644 index 00c4fb80..00000000 --- a/src/graphql/semknox/category/schema.graphqls +++ /dev/null @@ -1,61 +0,0 @@ -type Query { - categories ( - search: String @doc(description: "Performs a full-text search using the specified key words."), - filter: CategoryFilterInput @doc(description: "An array of categories that match the specified search criteria"), - pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."), - currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1."), - sort: CategorySortInput @doc(description: "Specifies which attribute to sort on, and whether to return the results in ascending or descending order.") - ): ESResponse -} - -input CategoryFilterInput @doc(description: "ProductFilterInput defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.") { - id: FilterTypeInput @doc(description: "An ID that uniquely identifies the category") - parent_id: FilterTypeInput @doc(description: "An ID that uniquely identifies the parent category") - description: FilterTypeInput @doc(description: "An optional description of the category") - name: FilterTypeInput @doc(description: "The display name of the category") - is_active: FilterTypeInput @doc(description: "Is active category") - path: FilterTypeInput @doc(description: "Category Path") - path_in_store: FilterTypeInput @doc(description: "Category path in store") - url_key: FilterTypeInput @doc(description: "The url key assigned to the category") - url_path: FilterTypeInput @doc(description: "The url path assigned to the category") - position: FilterTypeInput @doc(description: "The position of the category relative to other categories at the same level in tree") - level: FilterTypeInput @doc(description: "Indicates the depth of the category within the tree") - created_at: FilterTypeInput @doc(description: "Timestamp indicating when the category was created") - updated_at: FilterTypeInput @doc(description: "Timestamp indicating when the category was updated") - product_count: FilterTypeInput @doc(description: "The number of products in the category") - default_sort_by: FilterTypeInput @doc(description: "The attribute to use for sorting") - children: FilterTypeInput @doc(description: "Category children") - children_data: FilterTypeInput @doc(description: "Children category data") - children_count: FilterTypeInput @doc(description: "Category children count") - available_sort_by: FilterTypeInput @doc(description: "Available sorting option for category") - include_in_menu: FilterTypeInput @doc(description: "Include category to navigation menu") - display_mode: FilterTypeInput @doc(description: "Category display mode") - is_anchor: FilterTypeInput @doc(description: "Is filter avalaible in category") - page_layout: FilterTypeInput @doc(description: "Category page layout") -} - -input CategorySortInput { - id: SortEnum @doc(description: "An ID that uniquely identifies the category") - parent_id: SortEnum @doc(description: "An ID that uniquely identifies the parent category") - description: SortEnum @doc(description: "An optional description of the category") - name: SortEnum @doc(description: "The display name of the category") - is_active: SortEnum @doc(description: "Is active category") - path: SortEnum @doc(description: "Category Path") - path_in_store: SortEnum @doc(description: "Category path in store") - url_key: SortEnum @doc(description: "The url key assigned to the category") - url_path: SortEnum @doc(description: "The url path assigned to the category") - position: SortEnum @doc(description: "The position of the category relative to other categories at the same level in tree") - level: SortEnum @doc(description: "Indicates the depth of the category within the tree") - created_at: SortEnum @doc(description: "Timestamp indicating when the category was created") - updated_at: SortEnum @doc(description: "Timestamp indicating when the category was updated") - product_count: SortEnum @doc(description: "The number of products in the category") - default_sort_by: SortEnum @doc(description: "The attribute to use for sorting") - children: SortEnum @doc(description: "Category children") - children_data: SortEnum @doc(description: "Children category data") - children_count: SortEnum @doc(description: "Category children count") - available_sort_by: SortEnum @doc(description: "Available sorting option for category") - include_in_menu: SortEnum @doc(description: "Include category to navigation menu") - display_mode: SortEnum @doc(description: "Category display mode") - is_anchor: SortEnum @doc(description: "Is filter avalaible in category") - page_layout: SortEnum @doc(description: "Category page layout") -} \ No newline at end of file diff --git a/src/graphql/semknox/client.js b/src/graphql/semknox/client.js deleted file mode 100644 index 290e8c1d..00000000 --- a/src/graphql/semknox/client.js +++ /dev/null @@ -1,2 +0,0 @@ -import client from '../elasticsearch/client'; -export default client \ No newline at end of file diff --git a/src/graphql/semknox/json_type/resolver.js b/src/graphql/semknox/json_type/resolver.js deleted file mode 100644 index ca3dc756..00000000 --- a/src/graphql/semknox/json_type/resolver.js +++ /dev/null @@ -1,2 +0,0 @@ -import resolver from '../../elasticsearch/json_type/resolver.js'; -export default resolver \ No newline at end of file diff --git a/src/graphql/semknox/queryBuilder.js b/src/graphql/semknox/queryBuilder.js deleted file mode 100644 index 8bfb1e59..00000000 --- a/src/graphql/semknox/queryBuilder.js +++ /dev/null @@ -1,2 +0,0 @@ -import {buildQuery} from '../elasticsearch/queryBuilder.js'; -export {buildQuery} \ No newline at end of file diff --git a/src/graphql/semknox/taxrule/resolver.js b/src/graphql/semknox/taxrule/resolver.js deleted file mode 100644 index e8acb24b..00000000 --- a/src/graphql/semknox/taxrule/resolver.js +++ /dev/null @@ -1,2 +0,0 @@ -import resolver from '../../elasticsearch/taxrule/resolver.js'; -export default resolver \ No newline at end of file diff --git a/src/graphql/semknox/taxrule/schema.graphqls b/src/graphql/semknox/taxrule/schema.graphqls deleted file mode 100644 index acd89b30..00000000 --- a/src/graphql/semknox/taxrule/schema.graphqls +++ /dev/null @@ -1,15 +0,0 @@ -type Query { - taxrule(filter: TaxRuleInput): ESResponse -} - -input TaxRuleInput @doc(description: "TaxRuleInput specifies the tax rules information to search") { - id: FilterTypeInput @doc(description: "An ID that uniquely identifies the tax rule") - code: FilterTypeInput @doc(description: "The unique identifier for an tax rule. This value should be in lowercase letters without spaces.") - priority: FilterTypeInput @doc(description: "Priority of the tax rule") - position: FilterTypeInput @doc(description: "Position of the tax rule") - customer_tax_class_ids: FilterTypeInput @doc(description: "Cunstomer tax class ids of the tax rule") - product_tax_class_ids: FilterTypeInput @doc(description: "Products tax class ids of the tax rule") - tax_rate_ids: FilterTypeInput @doc(description: "Tax rates ids of the tax rule") - calculate_subtotal: FilterTypeInput @doc(description: "Calculating subtotals of the tax rule") - rates: FilterTypeInput @doc(description: "Rates of the tax rule") -} From fb46cada2899ec33941394d316eab4f30c68e06f Mon Sep 17 00:00:00 2001 From: PhoenixDev - YB Date: Tue, 18 Sep 2018 15:01:31 +0300 Subject: [PATCH 3/3] MTH-250 update graphql doc --- doc/2. graphQl support.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/2. graphQl support.md b/doc/2. graphQl support.md index f0e1a40a..181b56ea 100644 --- a/doc/2. graphQl support.md +++ b/doc/2. graphQl support.md @@ -45,6 +45,20 @@ const resolver = { For other entity types you can check schemas and resolvers in the /src/graphql/elasticsearch correspond subfolder +## GraphQl server host and test tool + +graphql server host is: + +:/graphql + +So by default it is http://localhost:8080/graphql + +Also for testing graphql requests Graphiql web tool can be used. It can be accesible by url: + +:/graphiql + +This tool allow to test graphql request online and show graphql server response immediatelly nad could be helpful fro development process. + ## Example request