We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44231
    • 126 Posts
    hi there!

    As progress to my old thread/ post here https://forums.modx.com/thread/85753/like-search-slow?page=2#dis-post-472753 I encounter some issue regarding match against in modx

    when I search for a particular word the query wont give me the exact search results

    for example:

    I've search 'acid' normally(in 'LIKE' base search with '%acid%') I can get 1 results
    but in match against search it gives me 0 result Im sure that the search must have at least 1 result.

    here is my code

    $search = $modx->quote($xkeywordx, PDO::PARAM_STR);
    $query = $modx->newQuery('Tblbook');
            $query->select(array (
                'Tblbook.system_product_id',
                'Tblbook.system_brand_id',
                'Tblbook.brand_name',
                'Tbooks.content',
                'Tblbook.company',
                'Tblbook.form_class',
                'Tgen.system_generic_id',
                'Tsec1.section1_id',
                'Tsec2.section2_id',
                'Tsec3.section3_id',
                'Tsec4.section4_id',
                "MATCH(Tblbook.brand_name, Tblbook.company)AGAINST ($search IN BOOLEAN MODE)",
                "MATCH(Tbooks.content, Tbooks.long_indication) AGAINST ($search IN BOOLEAN MODE)"
            ));
          
            $query->innerJoin('Tblbooks', 'Tbooks', array("Tblbook.system_brand_id = Tbooks.system_brands_id")); 
            $query->innerJoin('Tblbrandgenericgroupsms','Tgen',array("Tblbook.system_brand_id = Tgen.system_brand_id"));
            $query->innerJoin('Tblproductsections', 'Tprodsec', array(" Tblbook.system_product_id = Tprodsec.system_product_id")); 
            $query->leftJoin('Tblsection', 'Tsec', array(" Tprodsec.system_section_id = Tsec.system_section_id")); 
            $query->leftJoin('Tblsection1', 'Tsec1', array(" Tsec.system_section1_id = Tsec1.system_section1_id"));
            $query->leftJoin('Tblsection2', 'Tsec2', array(" Tsec.system_section2_id = Tsec2.system_section2_id"));
            $query->leftJoin('Tblsection3', 'Tsec3', array(" Tsec.system_section3_id = Tsec3.system_section3_id"));
            $query->leftJoin('Tblsection4', 'Tsec4', array(" Tsec.system_section4_id = Tsec4.system_section4_id"));
            $query->where(array("MATCH(Tblbook.brand_name, Tblbook.company)AGAINST ($search IN BOOLEAN MODE)",
            "MATCH(Tbooks.content, Tbooks.long_indication) AGAINST ($search IN BOOLEAN MODE)")
            );
            $query->groupBy('brand_name');
            $query->limit('50');
            $products = $modx->getCollection('Tblbook',$query);


    please give me some advise Im really in need with this one
    TYVM!