forked from splittingred/SimpleSearch
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Searching faqman tables not working #22
Comments
Are you trying to search faq's using simplesearch or trying to associate certain faq sets to a particular resource? |
trying to search them with SS - though, simple search relies on an association with a resource in order for it to work. |
I created a posthook that searches the faqs. <?php
$detailResource = 87;
$sortBy = 'rank';
$sortDir = 'ASC';
$packagePath = $modx->getOption('core_path').'components/faqman/model/';
$modx->addPackage('faqman', $packagePath);
$c = $modx->newQuery('faqManItem');
$c->where(array(
'question:LIKE' => '%'.$search.'%',
'OR:answer:LIKE' => '%'.$search.'%',
));
$c->sortby($sortBy, $sortDir);
$c->limit($limit,$offset);
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
$faqs = $modx->getCollection('faqManItem',$c);
$results = array();
foreach ($faqs as $faq) {
$modx->log(modX::LOG_LEVEL_DEBUG,'ID = '.$faq->get('id'));
$results[] = array(
'pagetitle' => $faq->get('question'),
'extract' => $faq->get('answer'),
'link' => $modx->makeUrl($detailResource,'', array('faqs' => $faq->get('id'))),
'id' => $faq->get('id'),
);
}
$hook->addFacet('faq',$results);
return true; |
Looks great [and thanks] but it still appears that we need to know what resource ID the faqs is in. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have this set up to search faqman faqs...
&customPackages='faqManItem:question,answer:faqman:{core_path}components/faqman/model/:faqManItem.set = modResource.id'
now - I know there is no relation between faqman items and any resource, I'm hoping I can link them somehow in a posthook, HOWEVER in this case the faqManItem.set just happens to match several resources. So it should at least be displaying something...
thoughts?
The text was updated successfully, but these errors were encountered: