Skip to main content

Questions tagged [search-criteria]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
163 views

Elasticsearch error after upgrading to 2.4.6-p3

I just upgrade to magento 2.4.6-p3 from 2.4.1 version, when i see the exception.log files, there are a lot of error stating this: main.CRITICAL: Elasticsearch\Common\Exceptions\BadRequest400Exception: ...
jojo's user avatar
  • 49
0 votes
0 answers
85 views

Magento 2.4.6 search synonyms doesn't work on REST API

I am trying to make use of search synonyms. I have created a synonym group, and added synonyms comma separated, and afterwards ran full re index. http://website/rest/V1/products?searchCriteria[...
Aniruddha Ray's user avatar
0 votes
2 answers
105 views

API searchCriteria not working with "FROM and TO" for "created_at" field, fetching the wrong results

Im trying to get data for orders that created between 2 dates(2023-10-05 - 2023-10-01). Im using the search condition type FROM and TO but its not fetching the right details. This is what im trying: ...
Almog Lahav's user avatar
0 votes
1 answer
40 views

REST API - probe error

how to get orders that are older than 1 hour from the current time. When I type NOW() -60, I get an internal error, log file never existed.
David Novák's user avatar
0 votes
0 answers
59 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
1 answer
487 views

Header search bar search terms retrieve products collection

I'm working on header autosuggest search, keywords that show the popularity of search suggestions based on old customers in that search suggetions. like if we search shirt then it suggest t-shirts, ...
user73267's user avatar
  • 183
2 votes
1 answer
28 views

I'm looking for the best intelligent search extinsion

I'm looking for the best intelligent search for Magento 2 CE. I need it to show the result fast and fix the issue if customer search for the product by miss spelling not the exact product name and ...
mido's user avatar
  • 69
0 votes
2 answers
924 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
713 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
948 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
765 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
1 vote
3 answers
966 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
0 votes
1 answer
3k views

Magento 2 API, searchCriteria usage on orders

I'm trying to retrieve recent orders from Magento 2.3.5, via REST API. I use this command: curl -X GET "https://my_magento_site/index.php/rest/V1/orders/search?searchCriteria[filter_groups][0][...
Massimo's user avatar
1 vote
0 answers
82 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
0 votes
1 answer
584 views

Magento 2 - Use search criteria to find configurable using attribute of their children

I have product X which is configurable. To product X I have assigned product Y and Z as simple ones. Both simple has attribute "Color". Now product Y has color: 123, product Z has color: 456....
K. Maliszewski's user avatar
1 vote
0 answers
126 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
0 votes
0 answers
43 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
  • 131
2 votes
1 answer
3k views

How to print searchCriteriaBuilder query in Magento 2?

How to print searchCriteriaBuilder query in magento 2 ? I tried below code but it is not working. $childProductIds = [1,2,3]; $sortOrder = $this->sortOrderBuilder->setField('price')->...
Pandurang Babar's user avatar
0 votes
1 answer
675 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
1 vote
0 answers
453 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
0 votes
1 answer
810 views

How to return products in stock via API REST using SearchCriteria?

I have an integration that must get my products in stock via the Magento 2 API using SearchCriteria. How could I filter it, since it's inside my custom_attributes?
Rafael Corrêa Gomes's user avatar
1 vote
3 answers
604 views

Rand sort on searchCriteria getItems

Is it possible to have a random sort when searching with repositories? Checked dev docs and unsure. Not found much elsewhere. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/searching-...
Dominic Pixie's user avatar
0 votes
2 answers
1k views

searchCriteriaBuilder using multiple sort

I've been experimenting with SearchCriteriaBuilder but I can't seem to get the syntax right to apply multiple sort. I've tried this $this->searchCriteriaBuilder->addFilter(EntryInterface::...
Dominic Pixie's user avatar
1 vote
0 answers
354 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
2 votes
1 answer
643 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
0 votes
1 answer
553 views

Magento 2: How to add OR condition b/w 2 AND conditions in Searchcriteria

I have a requirement where I found the list of specific orders according to the filtered conditions. I need to create a searchCriteria which I can pass to $this->orderRepository->getList($...
Gaurav Agrawal's user avatar
0 votes
0 answers
188 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
  • 569
0 votes
0 answers
27 views

Magento2: How to move featured products first in search result? [duplicate]

I want to sort the product search results by featured attribute(Yes/No type) so featured product comer first then show non-featured products. Currently, my search result is mixing in featured & ...
Purushotam Sharma's user avatar
2 votes
0 answers
52 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
  • 2,039
0 votes
1 answer
1k views

Magento 2 : To show category with in the top search bar results

How to show categories on the top search bar results? Do not want to interact with ElasticSearch as using MySQL search engine. Any sort of note would be much helpful.
Softec's user avatar
  • 2,085
2 votes
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
2 votes
0 answers
294 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,554
2 votes
0 answers
721 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
0 votes
1 answer
946 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
Brian N's user avatar
  • 931
1 vote
1 answer
491 views

Magento 2: How to add multilevel AND and OR conditions to searchCriteria?

What i want to achieve is this - attr1 = 'val1' AND attr2 = 'val2' AND ((attr_s1 = 'val_s1' AND attr_d1 = 'val_d1' AND attr_t1 = 'val_t1') OR (attr_s2 = 'val_s2' AND attr_d2 = 'val_d2' AND ...
Amol Agre's user avatar
1 vote
1 answer
384 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
180 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
  • 319
1 vote
1 answer
327 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
6 votes
1 answer
2k views

Difference between SearchCriteria VS SearchResults Vs SearchCriteriaBuilder and when should we use it?

For searching in repositories we are using searchCriteriaInterface but i noticed sometimes we are using SearchCriteriaBuilder as well. In which case we should use searchCriteriaBuilder? What's the ...
Jackson Wyss's user avatar
2 votes
0 answers
209 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
1 vote
0 answers
563 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
4 votes
2 answers
2k views

Search criteria builder does not filter an "out_of_stock" products

I am using Magento 2.3, Am filtering the product collection using the search criteria builder with a custom attribute as the filter. $filter1 = $this->_filterBuilder->setField('...
Octopus's user avatar
  • 355
0 votes
1 answer
71 views

Search type in Catalog don't search by Product's Name

I'm changed catalog search configuration to : System > Configuration > Catalog Search Type => Combine (Like and Fulltext) Product Listing Sort by => Name But when I search by name, the product ...
JhAndrade's user avatar
2 votes
1 answer
2k views

CatalogSearch results looking for partial SKU

I need to be able to search by partial string of a SKU, for example, if a SKU of a product is "CUS123.5NYS" the customer may also be able to search by "123.5N", but currently, it only works if I ...
Hector Andres Rojas's user avatar
2 votes
1 answer
4k views

How can we return an array of search results in APIs Magento 2

I need to return array of search results and so far I did this. DashBoardInterface.php <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ ...
Ramkishan Suthar's user avatar
4 votes
2 answers
1k views

Filtered response does not show total records in response of REST APIs in Magento 2

I am using GET V1/products endpoint to fetch product list. I want to fetch sku and name only. http://localhost/magento/rest/default/V1/products?searchCriteria[sortOrders][0][direction]=ASC&...
Ramkishan Suthar's user avatar
1 vote
0 answers
22 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
1k views

How to filter Multiselect in Magento 2 search Rest API?

I am using magento search rest api. Now i can filter attributes like neck, sleeve, etc.., but i need to give multiple values for same attribute (like mulitple select) My Request: rest/V1/search?...
Lovely Setia's user avatar
1 vote
1 answer
959 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