Questions tagged [search-criteria]

The tag has no usage guidance.

40 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
1 answer
2k views

Magento 2: How to change Advanced Search from "AND" to "OR"?

I'm stuck with this situation: I have 2 select-type attributes: A and B for example In both of the attributes, I have the same list of Options (but they are different option ids) For example In ...
linharex's user avatar
4 votes
0 answers
659 views

Magento 2 - Changing Default Search Query Behavior

I have the following search criteria: /?free_from%5B%5D=265&free_from%5B%5D=266 I'm trying to query all products and return ONLY products with both options A and B selected for the custom ...
Sophie Baxter's user avatar
3 votes
0 answers
517 views

Magento 2 rest api: Ignore out of stock products in get products search criteria

I am using the following api call to get products. {{base_url}}/rest/V1/products?searchCriteria[filter_groups][0][filters][0][condition_type]=like&searchCriteria[filter_groups][0][filters][0][...
Arun SS's user avatar
  • 441
2 votes
1 answer
492 views

How to get the product type by the product SKU?

I have some product SKUs in my custom module and I want to get just the simple products. I don't want to load each product entity by SKU in a loop to get the product type to avoid performance issues. ...
Rafael Corrêa Gomes's user avatar
2 votes
0 answers
51 views

Logical "NOT" in SearchCriteria

I found how to use logical "AND" & "OR" in search criteria: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/searching-with-repositories.html https://devdocs.magento.com/guides/v2.3/...
Alex Gusev's user avatar
  • 1,999
2 votes
0 answers
673 views

Magento 2 - REST API filter order data from shipping and billing address name and telephone number

I need to filter order data based on shipping and billing address name and telephone through rest api For example In order to filter data through status my request url would be something like this: ...
Muhammad Hasham's user avatar
2 votes
0 answers
205 views

Joins on search criteria

Is thery any way to join other tables to SearchCriteriaInterface, while building it, before calling any getList method of any repository? I mean it should work more or less like joining tables on ...
Bartosz Kubicki's user avatar
2 votes
1 answer
3k views

Magento 2 filter products by price from Rest API

Magento-2 we would like to filter the products from REST API I have filtered product by price in the frontend please check the result in the below screenshot (24-MB02 price and special price we ...
Nagaraju Kasa's user avatar
2 votes
0 answers
2k views

Custom Attribute Search using SearchCriteria

I have created some custom attribute like city and I need to search how many products I have in a specific city using SearchCriteria. The SearchCriteria I apply does not filter products on my city ...
Rajkumar .E's user avatar
  • 3,550
1 vote
3 answers
774 views

Magento 2.3: Search is not working for specific search terms/queries

I'm having a strange issue with our website. The issue is that, when I'm searching with some specific keywords like TV, AC, It's not giving me the results and its returning empty results as below ...
MagentoDev's user avatar
1 vote
0 answers
71 views

Using SearchCriteria and FIlterBuilders is it possible to have a nested AND condition inside ORs?

So I know how to create AND condition using the addFilter and how to add OR conditions using FilterBuilder however if I wanted to do do a search like (only using searchCriteria, no direct collection ...
IdiotDev's user avatar
1 vote
0 answers
120 views

How to change search query in quick search from 'like%' => '%like%'

I have word to search 'luma' I type 'lum'in search then I have result. But i type 'uma', I have no result. I think query of search is "LIKE 'value%'". So i want change it to "LIKE '%...
TrinhfTrinhf's user avatar
1 vote
0 answers
411 views

SearchCriteria vs Collection - Query Performance Difference

I am trying to refactor get category data method. Initially, it was written with Collection filter. Later I refactored with the search builder interface. When I tried to compare the querying time, I ...
blakcaps's user avatar
  • 1,965
1 vote
0 answers
312 views

Magento 2 Search - how to show result when customer search for a SKU with prefix and suffix? EX: AA-SKU1234

Is there a way to return result for 'SKU', if the customer search for the term like 'AA-SKU2033'? Currently, our product has the following format on the actual product sticker 'AA-SKU2033' 'AA-' is ...
Mage Explorer's user avatar
1 vote
1 answer
1k views

Magento 2 how to pass if exist search criteria in rest api call

I need to filter getList records in my rest api call. I have following: searchCriteria[filter_groups][0][filters][0][field]=city_ref&searchCriteria[filter_groups][0][filters][0][condition_type]=...
Duddy Woody's user avatar
1 vote
0 answers
269 views

Search using REST endpoints on two different columns with OR condition in Magento 2

I'm using Magento v2.3 and using API to search products. Following is the search criteria code. 'searchCriteria[filterGroups][0][filters][0][field]': 'name', 'searchCriteria[filterGroups][0][filters]...
Nausif's user avatar
  • 1,534
1 vote
1 answer
362 views

Why quantity_and_stock_status is always 1 in /V1/products?searchCriteria in Magento-2.2.7?

I am using Magento-2.2.7 . If i call this endpoint /V1/products?searchCriteria , it always show each product having same quantity_and_stock_status . Whenever product is in_stock or out_of_stock it ...
Lovely Setia's user avatar
1 vote
0 answers
1k views

Magento 2 Rest Api - Is this searchCriteria filter correct?

I'm trying to retrieve virtual products, which have been modified before a certain date and which still are in stock I'm using this /rest/V1/products?searchCriteria[filter_groups][0][filters][0]...
Mark CR's user avatar
  • 21
1 vote
1 answer
174 views

Fetch products from several SKUs where their price don't match from a list

I have a predefined list of SKUs with prices in an array, and I would like to return the products within Magento that matches those SKUs but not the price. As a quick solution, I have constructed an ...
Smithee's user avatar
  • 309
1 vote
1 answer
300 views

Escape initial percentage on Product Search Criteria REST API

I'm running the following request to search products by SKU using the Magento 2 REST API: curl -X GET "http://localhost/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=sku&...
Eduan Lenine's user avatar
1 vote
0 answers
544 views

Magento 2 - Query Builder

I need to create a query with searchCriteriaBuilder with this condition: WHERE visibility = [value] AND status = [value] AND ((category_id = [value] AND designer = [value]) OR (category_id = [value]))...
Mirko Rapisarda's user avatar
1 vote
0 answers
21 views

Sphinx Search - How to Hide Archive Products

How I can Hide Archive Products appearing in Search results We are using Sphinx Search, Do anyone know how not to show some products pages showing in search results. Thanks.
Rachna Thakur's user avatar
1 vote
1 answer
920 views

Use search_criteria to filter custom extension collection in Magento 2

I generated a custom extension with a custom model collection from mage2gen , is it possible to implement the search_criteria like when you retrieve product using rest api? what i know is the product ...
Tiny Dancer's user avatar
1 vote
0 answers
45 views

What is the proper way to perform a SEARCH with logic AND using the APIs?

I'm having trouble performing a search using the APIs. Below is the request I'm performing to my Magento backend: http://www.mybackend.com/rest/it/V1/products?searchCriteria[filterGroups][0][filters][...
Leonardo Minati's user avatar
1 vote
0 answers
238 views

order api search criteria

I have two magento accounts and i am fetching order with below route : ("/rest/V1/customers/search?searchCriteria[page_size]=20000&searchCriteria[current_page]=1&searchCriteria[...
Bodh1004's user avatar
  • 111
1 vote
1 answer
1k views

Magento 2 cannot set searchCriteria to rest api for categories

Tried using the url below to get all sub-categories, but it retuns all categories without filtering. http://127.0.0.1/magento/index.php/rest/V1/categories/?searchCriteria[filter_groups][0][filters][0]...
Ricky.C's user avatar
  • 2,162
0 votes
0 answers
40 views

prevent unwanted search terms in magento 2

I having some issue with some search term which shows the result with unwanted scripts. So how can I prevent the search term so that it does not show unwanted results? May anyone help me?
Ayush's user avatar
  • 101
0 votes
0 answers
11 views

Add "SortOrder" and "PageSize" Parameters(criteria) in get a category's products REST API

I need to sort the result of the category's products GET REST API by the product's position in the category. The API is like this: /rest/V1/categories/[category-id]/products And here is a sample ...
Armi_Raz's user avatar
0 votes
2 answers
694 views

AND logic search in magento 2 catalog search

i am working on a module which will change the search criteria from OR to AND. This module will fetch exact product while search.
Sayyed Hasan's user avatar
0 votes
0 answers
644 views

Magento 2 filter products collection by category and other attributes using filterBuilder

I'm trying to use a product repository to fetch a list of products. I want to fetch based on multiple filters (category_id, name, description and short description), combined with an OR criteria, but ...
mshifo's user avatar
  • 1
0 votes
1 answer
816 views

How to use custom product attribute in sorting option with search criteria builder for magento 2?

I have created one custom product attribute(bestseller). Now I want to sort by custom product attribute(bestseller) using search criteria builder sort by option but it's not working for custom product ...
Jitendra Patel's user avatar
0 votes
1 answer
560 views

Magento search Rest API how to get products all the detail in the response?

I want to get product all the detail in Search Rest Api response but Magento default is returning only id and custom_attributes attributes. Api :- `http://127.0.0.1/magento/rest/V1/search?...
Manish Goswami's user avatar
0 votes
0 answers
35 views

Allowed memory size exhausted, trying to select specific pages from widget

I am completely new in Magento and trying to create a widget that will simply display the selected pages on the frontend. That's what I have for now in my block class: public function getPages() { ...
Max Krizh's user avatar
  • 121
0 votes
1 answer
600 views

How to join a custom table and show its attribute on Magento 2 rest Api getList() function?

Im creating a custom product Api with searchCriteria from \Magento\Catalog\Model\ResourceModel\Product\Collection And I joined other table to this collection; public function getList(\Magento\...
โอ ศราวุธ's user avatar
0 votes
0 answers
178 views

Search Product by SKU programatically using search criteria

I need to search product programatically using search_criteria public function search($storeId, $searchTerm, $searchOrder, $searchDir, $page, $pageSize, &$totalSearchResults, &$attrs_applied, ...
Miguel's user avatar
  • 549
0 votes
1 answer
897 views

How to custom search function in Magento 2

Because the search of Magento 2 works wrong with my shop, I want a custom search function in Magento 2 but I don't know it where. Please help me, where is function in vendor
TN98's user avatar
  • 923
0 votes
0 answers
493 views

How to filter a product by a datetime attribute in Magento2?

I am trying to filter products on a search by an attribute of type 'datetime'. The problem is it does not filter by it, so it shows all the results. I have tested other attributes and it works fine, ...
awavi's user avatar
  • 989
0 votes
2 answers
934 views

Cannot search correct result

I have a product named C.I.D However, I am not able to search it in Magento 2.0 I guess it's related to the dot character. Anyone got idea on how to fix it? Thanks
Leo Chiu's user avatar
  • 307
0 votes
1 answer
742 views

How can I accomodate category names also to the magento quick search?

I am new to magento2, I wanted to know how we can bring category names also to the quick search. For eg: When I search using a keyword 'Bag', I should get a list off all products under the category "...
Arun S's user avatar
  • 191
0 votes
0 answers
129 views

Magento Filter search on search page

Is there any way around that I can filter search result using via search. Example : Suppose I am on home page and there I searched "blue" in the search box. Now I am on the search result page ({{...
Anshu Mishra's user avatar
  • 8,910