We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19486
    • 14 Posts
    Hi,

    I have a custom table with content and an according docid stored in it. Is it possible to search those fields in this custom table? Do I have to build an XPDO schema?? How does it work? Documentation of the joined resources did not bring any clues to me...

    Hope it is not a dump question *G*

    Greets
    MikeMcNuke
      • 5811
      • 1,717 Posts
      You need to provide the package name of your custom table. So you have to build an XPDO schema.

      Read the chapter Declaration syntaxes - Joined of the query hook document.
      This document is available from http://www.revo.wangba.fr/assets/files/cheatsheets/queryHook110_v1.0.pdf

      Look also the demo named Dvd
        • 19486
        • 14 Posts
        Hi,

        many thanks for your tips. Will look into it!!!

        Bye
          • 19486
          • 14 Posts
          Hi,

          model and schema is created. Works great.

          but now I still don't know what to do next...

          I should fill out the joinCriteria...but how should I fill it out so AdvSearch can tie a row of data from my table to a DocID ?? Is this even possible with it?

            • 19486
            • 14 Posts
            Hi,

            model and schema is created. Works great.

            but now I still don't know what to do next...

            I should fill out the joinCriteria...but how should I fill it out so AdvSearch can tie a row of data from my table to a DocID ?? Is this even possible with it?

            Edit:
            Will try it with this snippet:
            <?php
            $joined = array(
            array(
            'package' => 'JHWproducts',
            'class' => 'jhwp',
            'packagePath' => '{core_path}components/JHWproducts/model/',
            'fields' => 'content',
            'withFields' => 'content',
            'joinCriteria' => 'jhwprodukte.docid = modResource.id'
            )
            );

            $qhDeclaration = array(
            'qhVersion' => '1.1',
            ‘joined’ => $joined,
            );

            $hook->setQueryHook($qhDeclaration);
            return true;

            Also tried this join:

            'joinCriteria' => 'jhwprodukte.docid = site_content.id'

            But no results... [ed. note: MikeMcNuke last edited this post 12 years, 7 months ago.]
              • 5811
              • 1,717 Posts
              Look at the quipQHook snippet used on the quip demo. You can download the queryHook snippet examples from the documentation page.

              Quip table is a joined table for the site_content table too.

              $joined = array(
                  array(
                      'package' => 'quip',
                      'class' => 'quipComment',
                      'packagePath' => '{core_path}components/quip/model/',
                      'fields' => 'author , body , createdon ',   // displayed fields
                      'withFields' => 'body',                     // search only in body field
              		'where' => array(							// where clause is primordial to avoid to search inside unapproved comments
                          '((`quipComment`.`deleted` IS NULL) OR (`quipComment`.`deleted` = 0))',
                          '((`quipComment`.`approved` IS NULL) OR (`quipComment`.`approved` = 1))'
              		),
                      'joinCriteria' => 'quipComment.resource = modResource.id'
                  )
              );



              EDIT:
              if jhwp is the class name, you should try :

              $joined = array(
              array(
              'package' => 'JHWproducts',
              'class' => 'jhwp',
              'packagePath' => '{core_path}components/JHWproducts/model/',
              'fields' => 'content',
              'withFields' => 'content',
              'joinCriteria' => 'jhwp.docid = modResource.id'
              )
              ); [ed. note: coroico last edited this post 12 years, 7 months ago.]
                • 19486
                • 14 Posts
                Ah, ok thanks.