Jump to content

[PS 1.6.1.11] Problem z wyszukiwarką


chomiczek

Recommended Posts

Witajcie, mam problem z wyszukiwarką, a mianowicie jeżeli chce wyszukać nazwę produktu po jego całej nazwie, np.:
"Nazwa mojego produktu wyszukiwanego przeze mnie" to zamiast w wynikach wyszukiwania otrzymać 1 produkt (bo tylko 1 ma taką nazwę) to otrzymuje ponad 600 wyników :/
 

Zapewne, a raczej na pewno dzieje się to z uwagi na takie zapytanie, które jest używane do wyszukiwania:
 

SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, m.`name` manufacturer_name ,( SELECT SUM(weight) FROM ng_search_word sw LEFT JOIN ng_search_index si ON sw.id_word = si.id_word WHERE sw.id_lang = 1 AND sw.id_shop = 1 AND si.id_product = p.id_product AND (sw.word LIKE 'nazwa%' OR sw.word LIKE 'mojego%' OR sw.word LIKE 'produktu%' OR sw.word LIKE 'wyszukiwanego%' OR sw.word LIKE 'przeze%' OR sw.word LIKE 'mnie%') ) position, DATEDIFF( p.`date_add`, DATE_SUB( "2017-05-25 00:00:00", INTERVAL 7 DAY ) ) > 0 new, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, IFNULL(product_attribute_shop.`id_product_attribute`,0) id_product_attribute FROM ng_product p INNER JOIN ng_product_shop product_shop ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1) INNER JOIN `ng_product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = 1 AND pl.id_shop = 1 ) LEFT JOIN `ng_product_attribute_shop` product_attribute_shop ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop=1) LEFT JOIN ng_stock_available stock ON (stock.id_product = p.id_product AND stock.id_product_attribute = 0 AND stock.id_shop = 1 AND stock.id_shop_group = 0 ) LEFT JOIN `ng_manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` LEFT JOIN `ng_image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop=1) LEFT JOIN `ng_image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = 1) WHERE p.`id_product` IN (30,31,32,57,70,149,150,151,152,153,154,155,156,161,163,164,165,166,167,169,170,176,177,178,179,181,187,188,189,190,194,201,203,204,205,207,213,216,217,218,222,223,225,226,227,228,229,230,231,232,234,235,236,237,243,244,245,246,247,251,254,257,259,260,261,263,265,266,268,269,276,279,280,282,284,285,286,287,289,290,291,301,302,303,304,305,306,307,308,313,314,315,319,320,327,329,330,338,339,365,366,368,375,380,381,386,387,388,389,390,391,392,394,396,397,398,408,412,418,420,421,428,430,442,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,462,854,887,888,895,898,902,906,909,915,920,921,922,923,925,927,928,929,930,931,932,934,936,939,940,941,945,946,947,948,949,950,951,952,953,955,956,957,958,959,960,961,963,964,973,974,975,976,977,978,980,981,983,984,987,988,990,992,993,994,1002,1004,1005,1013,1019,1020,1021,1022,1023,1024,1025,1026,1027,1030,1033,1034,1035,1037,1038,1047,1050,1068,1069,1070,1071,1094,1095,1096,1098,1099,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1117,1118,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1142,1143,1144,1146,1160,1161,1162,1163,1172,1173,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1226,1227,1228,1231,1232,1233,1234,1244,1245,1246,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1291,1293,1295,1306,1307,1308,1309,1310,1326,1327,1328,1334,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1365,1366,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1390,1391,1392,1393,1394,1397,1398,1399,1400,1401,1404,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1442,1443,1444,1445,1446,1447,1448,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1636,1637,1638,1639,1640,1641,1642,1645,1646) GROUP BY product_shop.id_product ORDER BY position desc LIMIT 0,30

Pytanie, co z tym można zrobić? Najprościej, niby zrobić override klasy Search.php i wywalić ten kod odpowiedzialny za rozbijanie zapytania na poszczególne wyrazy, ale czy to na pewno dobre rozwiązanie.

Ten sam produkt wyszukiwany na PS 1.5.x znajduje się prawidłowo (znajduje tylko 1 pozycję).

Jakieś sugestie/pomoc?

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...