neti_treves Posted July 5, 2019 Share Posted July 5, 2019 Hi all, I've created some more db fields for my products. How can I have the search query go through these new fields as well? Thanks Link to comment Share on other sites More sharing options...
neti_treves Posted July 11, 2019 Author Share Posted July 11, 2019 up any help? please! There should be a stupid Mysql line where to add the new field, I just can't find it! Link to comment Share on other sites More sharing options...
bsmither Posted July 11, 2019 Share Posted July 11, 2019 Ooops! I lost track of this project. Several versions back, I created a Code Snippet that adds the fields to the searchable collection of fields. I need to double check that it still works for CC625. If you want to verify if, in the snippet's current version, works for you, send me a Private Message with your email address. Link to comment Share on other sites More sharing options...
bsmither Posted July 12, 2019 Share Posted July 12, 2019 Well, it's not what I thought it was. But I will keep working on a solution. Link to comment Share on other sites More sharing options...
neti_treves Posted July 13, 2019 Author Share Posted July 13, 2019 Anyone else? Does someone know at least where I can find the Mysql line which operates the search? Thanks Link to comment Share on other sites More sharing options...
bsmither Posted July 13, 2019 Share Posted July 13, 2019 In /classes/catalogue.class.php, the public function searchCatalogue(), has the code to take the search terms, incorporate other search criteria, builds the JOINs of other tables, if necessary, and builds the WHERE clause, and sends the query to the database. This function is attempted up to three times, each using a different database search mechanism: FULLTEXT (will not work with other than fulltext indexes), then if nothing found uses RLIKE (regular expressions), then if nothing found uses a more lenient LIKE (simple wildcards). Link to comment Share on other sites More sharing options...
[email protected] Posted September 30, 2019 Share Posted September 30, 2019 Hi all, I found the code which says : $like = " AND (I.name ".$like_keyword." '".$regexp."' OR I.description ".$like_keyword." '".$regexp_desc."' OR I.product_code ".$like_keyword." '".$regexp."')"; However, when I change 'description' to another data base column it starts searching in that new column indeed but still keeps searching the 'description' one too. Would anyone know why ? Link to comment Share on other sites More sharing options...
bsmither Posted September 30, 2019 Share Posted September 30, 2019 CubeCart makes searches using up to three methods. The first method uses what is called "FULLTEXT" search on an index that is created against the columns 'product_code', 'description', and 'name'. If nothing is found, then the second method uses regex expressions on the named columns. If that returns nothing, the third method uses simple wildcards on the named columns. So, if your search results are including words in the description, then perhaps the search process is finding those results using the first of the search methods. The second and third methods use the SQL query - the $like string - which you posted earlier. Link to comment Share on other sites More sharing options...
[email protected] Posted October 8, 2019 Share Posted October 8, 2019 I have been trying to understand how to avoid the keywords searching into the description columns but all to no avail. I guess this is too complex in the whole catalogue.class.php scripting to amend. I have made made changes but this is now beyond me... Thank you in any case. Link to comment Share on other sites More sharing options...
[email protected] Posted October 10, 2019 Share Posted October 10, 2019 I actually got it. You can amend the code at /classes/catalogue.class.php, the public function searchCatalogue(). you can add the column you want the search engine to look at below : $like = " AND (I.name ".$like_keyword." '".$regexp."' OR I.description ".$like_keyword." '".$regexp_desc."' OR I.product_code ".$like_keyword." '".$regexp."')"; However, if you want to avoid the search engine from looking into the description column you need to DROP it from the indexes in your MySQL database in the FULLTEXT keyname. You can therefore add other columns instead there and make it search where you want it. tricky.... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.