We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37210
    • 131 Posts
    insightdesign Reply #1, 11 years ago
    I have tried both SimpleSearch and AdvSearch but haven't gotten anywhere.

    Has anybody had success using either one of these snippets to search through the Gallery?

    My website's info:

    MODx 2.2.7
    AdvSearch 1.0.1
    SimpleSearch 1.6.1

    AdvSearch
    I've tried AdvSearch but had an error come up (below) once I put in &engine='Zend' into the snippet call. I've uploaded the Zend library that Coroico instructs us to use, but still no go:
    Fatal error: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Index doesn't exists in the specified directory.' 

    I've also put the indexation.php file into the root of my directory. Does it matter that I'm working in a test context? I've edited the $id value on line 22 as instructed as well.

    SimpleSearch
    With SimpleSearch, I'm having an issue with the FacetHook snippet. I have no freakin' clue what I'm doing! I tried following the tutorial on the RTFM site, as well as trying to follow what I'm finding from other posts, but I'm obviously missing something.
    What would I edit to make the following FacetHook snippet code search through the Gallery?
    <?php
    $c = $modx->newQuery('modUser');
    $c->innerJoin('modUserProfile','Profile');
    $c->where(array(
        'username:LIKE' => '%'.$search.'%',
        'OR:Profile.fullname:LIKE' => '%'.$search.'%',
        'OR:Profile.email:LIKE' => '%'.$search.'%',
    ));
    $count = $modx->getCount('modUser',$c);
    $c->select(array(
        'modUser.*',
        'Profile.fullname',
        'Profile.email',
    ));
    $c->limit($limit,$offset);
    $users = $modx->getCollection('modUser',$c);
     
    $results = array();
    foreach ($users as $user) {
        $results[] = array(
            'pagetitle' => $user->get('fullname'),
            'longtitle' => $user->get('email'),
            'link' => $modx->makeUrl(10,'',array(
                'user' => $user->get('id'),
            )),
            'excerpt' => '',
        );
    }
    $hook->addFacet('people',$results,$count);
    return true;

    Any help appreciated!
    Sar
    • Hello, did you find a solution ?
        • 37210
        • 131 Posts
        No sad

        I put the issue aside after trying a few things and haven't looked at it for a month or so. But I'm picking it up again now. Unfortunately haven't found anything that works.
          • 37210
          • 131 Posts
          Quote from: hartus at Jun 30, 2013, 05:19 PM
          Hello, did you find a solution ?

          Hi Hartus,

          Are you still in need of help with this problem? Just writing this just in case this helps you or anyone else. So, the main points which have to be in place before AdvSearch works in Zend/dynamic mode:

          Zend Library

          Indexation.php File
          • 'indexation.php' file needs to be placed in the root directory of your website. You can find this indexation.php file on Coroico's site: http://www.revo.wangba.fr/advsearch-documentation.html
          • Edit line 22 of the indexation.php file. So, you will type in the ID numbers of the resources you want to search through. Mine looks like this $ids = '2,54,18,22,35,43,52,49,85';. (Since I was working in the dev environment, I changed line 31 from 'web' to 'dev'.)
          • Once you have done those edits, in your web browser, visit the indexation.php file to run it, so I visited dev.mywebsite.com.au/indexation.php. Straightaway, you should then see the output of the indexation.php script in plain text. You will recognize the resource page titles and resource IDs. Nothing further needs to be done in regards to the indexation.php file.

          Snippet Call
          Once you have done those edits, you can install AdvSearch into your website so you can start using it.
          This is what my snippet calls look like:
          [[!AdvSearchForm]]
          [[!AdvSearch? &engine=`all` &contexts=`dev` &perPage=`5` &ids=`2,54,18,22,35,43,52,49,85`]]

          From what I gather, you have to run the indexation.php after every change to your dynamic content.


          Extra Info:I found this thread to be the most helpful (page 2 to be exact): http://forums.modx.com/thread/?thread=47849&page=2