On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I combined Tagger with AdvSearch using a hook, as explained by Adam Lundrigan (site is offline, I used google cache to look at his code).

    This is the snippet:

    <?php
    
    $modxTablePrefix = 'modx_';
    $taggerModelPath = '{core_path}components/tagger/model/';
    
    $hook->setQueryHook(array(
        'qhVersion' => '1.2',
        'joined' => array(
            array(
                'package' => 'tagger',
                'class' => 'TaggerTagResource',
                'packagePath' => $taggerModelPath,
                'withFields' => 'resource',
                'tablePrefix' => $modxTablePrefix,
                'joinCriteria' => 'TaggerTagResource.resource = modResource.id'
            ),
            array(
                'package' => 'tagger',
                'class' => 'TaggerTag',
                'packagePath' => $taggerModelPath,
                'withFields' => 'tag',
                'tablePrefix' => $modxTablePrefix,
                'joinCriteria' => 'TaggerTag.id = TaggerTagResource.tag'
            ),
        )
    ));
    
    return true;  


    And this is the advSearch snippet call. It works, however I can't get fieldPotency to take the Tagger field. I tried this:

    [[!AdvSearch?
    &hideContainers=`0`
    &minChars=`2`
    &fields=`pagetitle,content,introtext`
    &withFields=`pagetitle,content,introtext,description`
    &highlightTag=`strong`
    &searchIndex=`zoekterm`
    &perPage=`10`
    &engine=`mysql`
    &pagingType=`1`
    &pagingSeparator=``
    &showExtract=`1:introtext,content`
    &addCss=`0`
    &addJs=`0`
    &toPlaceholder=`searchresults`
    &init=`all`
    &offsetIndex=`start`
    &queryHook=`searchTagger`
    &fieldPotency=`pagetitle:100, tag:80, content:50, introtext:30, description:10`
    &sortby=`score DESC`
    ]]


    The problem is first of all I don't know how to reference the Tagger field (used 'tag', but not sure if that's correct) and second of all I don't know if it's possible to use a joined field in the fieldPotency field. For now, this example isn't working. The resource with a value in Tagger that is searched for IS found, but it's not on top of the list, as I would expect because of the fieldPotency.

    Does anyone know if it's possible, and if so what I should do exactly?

    Thanks a lot! [ed. note: michelle84 last edited this post 4 years, 3 months ago.]
    • Have you run the indexation script?
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
      • ehm, no, I haven't... Didn't realize that was necessary, because the search DOES work with Tagger, just not the fieldPotency. The resource with a match in the Tagger field now comes in as the last result, but it should be the first because of the fieldPotency settings, unless I'm doing something wrong. Actually I don't really know what the indexation script is for at all.

        Would you be so kind as to explain a little more about it and what snippet call etcetera I should use to make it work?
        • Attached is the original indexation script for v 1.0.1-pl

            Rico
            Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
            MODx is great, but knowing how to use it well makes it perfect!

            www.virtudraft.com

            Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

            Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

            Maintainter/contributor of Babel

            Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
          • Hi Goldsky,

            I'm still struggling with this, hope you have time to give me a hand.
            I looked at the indexation script, but I don't see how it would help since the Tagger addon doesn't use TV's to store the values. Am I understanding this wrong?

            The values from Tagger are only searchable because I joined the table in the Advsearch call with a query hook. That works, but can Advsearch use values from a joined table for the fieldpotency or is it impossible?

            • I would still be interested in the answer to my question above about joining Tagger, but I've solved the problem another way right now with a plugin that copies the Tagger values to a tv, which I can easily use in AdvSearch.
              • Quote from: michelle84 at Aug 14, 2015, 09:19 AM
                I would still be interested in the answer to my question above about joining Tagger, but I've solved the problem another way right now with a plugin that copies the Tagger values to a tv, which I can easily use in AdvSearch.
                Hello Michelle, I am struggling with the same problem to get SimpleSearch to search in Tagger, and no solution yet. Can you explain how I can get the Tagger values in a tv?