SimpleSearch - customPackages - search in "Glossary" and "FAQ Manager" extras

Hi there!

I’m using the lastest MODX 2.7.2 with

  • SimpleSearch 2.1.2,
  • Glossary 2.4.1
  • FAQ Manager 2.00-rc3.

SimpleSearch is working fine on the usual fields, but I need it to search inside the items of the mentioned extras Glossary" and “FAQ Manager”.

In the SimpleSearch-docs there is descibed how to search in custom tables:

Searching custom tables is available in SimpleSearch using the &customPackages property; however, you must have a custom package built for it. The format is:


The example provided there is based on the Quip-Extra.

Here’s what should be added to search inside the Quip-Comments:

&customPackages=`quipComment:body:quip:{core_path}components/quip/model/:quipComment.resource =

I tried to do this for the FAQ Manager like this:

&customPackages=`faqman:answer:faqman:{core_path}/components/faqman/model/:faqman.resource =`

But this did not work.

More detailled information is provided on the doc-site as well:

  • className - The class name of the table you want to search. Here, it’s QuipComment.
  • fieldName(s) - A comma-separated list of column names to search. We did ‘body’, you could also have done ‘body,email’ or whatever.
  • packageName - The name of the schema Package to add. This one is called quip.
  • packagePath - The path to the model/ directory where the package is located.
  • joinCriteria - The SQL to join the table you want to search and the modResource table. Your table must have some connection to the Resource it’s on (otherwise SimpleSearch won’t know how to load a URL for it!)

Once you’ve added it, it will search those fields as well for data. If it finds it in that table, it will display the result as a link to the Resource you specified in your joinCriteria. In our example, that would be the resource the Quip comment is located on.


In the example “quipComment” is used as the className.

But in another install where I used MODX with Quip, I can’t find any table called “quipComment”, just “quip_comment_notify”, “quip_comments”, “quip_comments_closure” and “quip_threads”. So I don’t know where the “quipComment” comes from?

The FAQ Manager tables are called “faqman_items” and “faqman_set”. The relevant table is the “faqman_items”, so I tried “faqman” and “faqmanItem” as well as “faqmanItems”, but no success. So I’m a bit lost at this point already…


In the example “body” is used as the fieldName. This is a column inside the table “quip_comments”.

So for me the relevant columns are “question” and “answer”. I tried both, but without success as well.


In the example “quip” is used as the packageName, so I have to use “faqman”.


In the example “{core_path}components/quip/model/” is used as the packagePath, so I have to use “{core_path}/components/faqman/model/”.


This one I don’t get right I guess.

In the example “quipComment.resource =” is used as joinCriteria. In the table “quip_comments” is a column called “resource”, so this I understand.

In my case I want the results based on the FAQ Manager entries always linking to the same resource (on this resource there are all created FAQs displayed).

Same for the Glossary-extra:

There is only one table created called “glossary”. The relevant columns are called “term” and “explanation”. The “21” i used for the “joinCriteria” is the resource the glossarygets diplayed.

I tried different things, ended up with this:

&customPackages=`glossary:explanation:glossary:{core_path}/components/glossary/model/:21 =`]]

But still no success.

So does anyone has used the customPackages with success and has a hint for me?

Greetings to the forum!

Ok, I did a little bit of progress…

For the “FAQ Manager”-extra, this code mainly works:


&customPackages=`faqManItem:answer:faqman:{core_path}/components/faqman/model/ =` ]]

My only problem right now is to tell the in “joinCriteria”-part, that the script shouldn’t grab the “” as the “” - it shall use a static value of the resource, where the link should go to (22 in this case).

Same for the “Glossary”-extra:

&customPackages=`Term:explanation:glossary:{core_path}/components/glossary/model/ =`

Here also it should be a static link to a resource (21 in this case).

The correct name for the “className” is stated in the schema.xml-file that belongs to the package.

For the “FAQ Manager” it’s:

<object class="**faqManItem**" table="faqman_items" extends="xPDOSimpleObject">

For the “Glossary” it’s:

<object class="**Term**" table="glossary" extends="xPDOSimpleObject">

So next step, finde the correct way to statically link to an given resource-id for each customPackage.

ok, that was easy:

&customPackages=`Term:explanation:glossary:{core_path}/components/glossary/model/:21 =`

Simply add the resource-id before the equal-sign.

For both packages the customPackages-part looks like this:

&customPackages=`faqManItem:answer:faqman:{core_path}/components/faqman/model/:22 =||Term:explanation:glossary:{core_path}/components/glossary/model/:21 =`

Still something to do - if possible…

The search-result page outputs the pagetitle of the resource I defined in the “joinCriteria”-part.

It would be great if the linktitle would not be the pagetitle of the resource I defined, it would be better to have the content of the “question”- or “term”-column as the linktitle. Best solution would be to have both - content of “question”- or “term”-column plus the pagetitle afterwards…

I guess this can be accomplished somehow…I’ll dig deeper…

I’ve got to revive this topic, since I couldn’t solve my last problems,

  1. to display the glossary-term/glossary-explanation or the faqManager-question/faqManager-answer as the SimpleSearch-title and SimpleSearch-extract on the Simple-Search-results-page.

  2. and to link to the correct faqManager-entry or the glossary-entry.

For example:

if i search for a word that is inside an faqManager-question or an faqManager-answer, by using this code I posted already above:

&customPackages=`faqManItem:question,answer:faqman:{core_path}/components/faqman/model/:22 =||Term:term,explanation:glossary:{core_path}/components/glossary/model/:21 =`

the search result shows the pagetitle of the resource 22, which was defined in the joinCriteria-part.

Is it possible to retrieve the faqManager-question-content and show this, instead of the pagetitle? And also use the faqManager-answer as the SimpleSearch-extract?

I guess I need to edit the Simple-Search-result-chunk, but I already tried a lot of placeholders by chance, like [[+faqMan]], [[+faqManItem]], [[+faqManItem.question]], [[+faqManItem]], [[+faqman]], [[+faqmanItem]], but as expected without success. I don’t know how to grab the needed data to get them displayed in the search-results.

Second problem:

With the code above the Simple-Search-result-entry links to the resource 22. I want the link to point to the faqManager-entry on the resource 22. On resource 22 the faqSets and their entries are listed in accordions and each entry has an ID (in my example the correct ID is 13).

So I tried to grab the id of the faqManager-database entry, that contains the search-term by using this:

&customPackages=`faqManItem:id,question,answer,set:faqman:{core_path}/components/faqman/model/ =||Term:term,explanation:glossary:{core_path}/components/glossary/model/:21 =` ]]</p>

I added the “id”- and “set”-columns to the “fieldNames” and changed the ID of the resource (22) to =>

The Simple-Search result page now shows the pagetitle of the resource with the ID 13, which is the ID of the faqManItem. So this is kind of correct, because I’m getting the right ID.

But this refers as the, like it is defined in the joinCriteria-part. I couldn’t find any forum-entry, which might help me to get an idea what else might be possible to use here, instead of the “”?

Thank you for your time!

1 Like

Well if you are getting the right pagetitle then you’ve gotten the right element.

You are right to look for the placeholders I think, can you get any data out of the item other than id number? I’m unsure how to know what designation it would have, are they perhaps done in the html? You may want to drill down with FAQ manager as to the designation.

When you say resource do you mean Modx resource? Like in the tree, id 13 is this particular item?

Snippets and chunks and so on have their own ids, and its not the same as resource ids.

If each item is a resource then you could try the term ‘content’ as welll

1 Like

Thx for your answer nuan88!

I am getting the pagetitle of the resource with the ID 22 (which is “FAQs”) - because this ID gets defined in the joinCriteria-part:

&customPackages=`faqManItem:answer:faqman:{core_path}/components/faqman/model/:22 =||Term:explanation:glossary:{core_path}/components/glossary/model/:21 =`

But what I want to achieve is to get the faqMan-question (“What is the difference between…”) instead of the pagetitle.

This is one part where I’m failing. But I think Simple-Search only can output it’s own placeholders, like [[+extract]], [[+resultInfo]], etc. and not the ones from the FAQ-Manager?

The snippet-call looks like this:

    &customPackages=`faqManItem:id,question,answer,set:faqman:{core_path}/components/faqman/model/ =||Term:term,explanation:glossary:{core_path}/components/glossary/model/:21 =` ]]

And the chunk “mySearchResult”:

<div class="simplesearch-result">
    <h3>[[+idx]]. <a href="[[~[[+id]]]]" title="[[+longtitle]]">[[+menutitle:default=`[[+pagetitle]]`]]</a></h3>
    <div class="extract">

The “correct” ID “13” I mentioned above is the ID from entry/row in the modx_faqman_items-table in the DB. In my example I search for a word (“klassisch”), which is inside an entry of the FAQ-Manager-extra. This entry has the ID “13”.

I am getting this correct ID by using “” in the joinCriteria-part: =

But as this got related to “”, the link directs to the resource with the ID of 13, which is wrong.

It should link to the resource with ID 22, and additionally a hashtag like “term-ID”, so the link goes to the correct entry on the FAQ-page (22), for example

Hope this helps it make it clearer…

Right, resources in Modx means the documents in the tree, you’re not going to want to do that.

given that, how about faqManItem.question faqManItem.answer and so on? For the output

Ok, a little progress - or maybe not…this leads to another problem…

From the Simple-Search-docs:

So I added the extractSource-property to my snippet-call using the “faqMan” snippet-name:

    &customPackages=`faqManItem:id,question,answer,set:faqman:{core_path}/components/faqman/model/ =||Term:term,explanation:glossary:{core_path}/components/glossary/model/:21 =` ]]

With this addition the Simple-Search-[[+extract]]-placeholder outputs the correct content from the FAQ-Manager entry with ID “13” - yay! But the link is still wrong, directing to resource 13 => should be resource 22 (“faq#term-13”).

So I tried this in the joinCriteria-part: =

because “22 =” worked as the correctly directing link to resource 22 (FAQs). I naively hoped by adding “” I could generate a hash (like “#term-13”), but this obviously did not work and broke the Simple-Search-output :wink:

New problem

And additionally with the added extractSource-property, when I search for another word that is used quite often on different resources of that project, the Simple-Search-result-titles and the links they are directing to are correct, but the extract is the same for each entry and does not come from the resource-content. The extract comes from the first entry of the FAQ-Manager with the ID 1. So this is completely wrong.

So I tried to add the faqMan to the default value (content) of the extractSource-property like this:


But this doesn’t seem to work and “cuts” the [[+extract]]-placeholder => no output.

I also don’t get this from the Simple-Search-docs:

As i wrote before i tried to use the FAQ-Manager-placeholders like [[+question]], [[+answer]], but without success.

1 Like

I already tried many combinations like you suggested, but again without success…

1 Like

So far only the id…hmmm

The reason you got the same data coming out for each one is because you’ve got the faqItem id fixed and its only outputting that one. You seem to want to do it programmically and I am not sure how.

You’ve got the id outputting, why not check FAQ Manager for the fields…

Seems to me what you want is something like [[~id]]#[[]]

Which means the resource id (22) and then each of the faqs

That would convert to

I did some further testing related to this from the docs:

So I created a new snippet called “test”


// glossary-content
if ( $alias == 'glossary' ) {
    echo $alias.' - '; // output = glossary
    echo $id.' - '; // output = 21
    echo $content;  // output = longtitle of resource 21      

// faq-content
else if ( $alias == 'faq' ) {
    echo $alias.' - '; // output = faq
    echo $id.' - '; // output = 22
    echo $content;  // output = longtitle of resource 22      

// normal content
else {
    echo $content;  // output = correct Simple-Search extract

and use it in my snippet-call:

&customPackages=`faqManItem:id,question,answer,set:faqman:{core_path}/components/faqman/model/:22 =||Term:term,explanation:glossary:{core_path}/components/glossary/model/:21 =` 

This way the Simple-Search-result-list-entries get outputted differently.

Searching in the “normal”-content works well.

Searching in the “FAQ Manager”-content works with the code above like the normal way: showing the pagetitle of resource 22 (“FAQs”) and the extract is taken from longtitle.

Searching in the “Glossary”-content does the same: showing the pagetitle of resource 22 (“Glossary” and the extract is taken from longtitle.

In the test-snippet I tried to look for any variable or placeholder that holds the with




but no sign of any of data from FAQ-Manager nor Glossary…

At this point I’m pretty clueless…and for me the SimpleSearch is useless this way, because a lot of content comes off these two extras…i wasn’t aware that this might be so hard to achieve, otherwise i would have tried a completely different approach in the beginning…i guess i have to think of a whole new concept then. This all is doable with resources and getResources I think, but i first thought using these extras would make life easier…

EDIT (additional info): I also tried this approach, but with no success either…

1 Like

Yes, I understand the frustration. And its hard for people to help because its quite detailed and very specific. Sometimes in development a plan doesn’t work out.

Well, let’s dial it back a bit and figure out what you want and how we could achieve it.

I do feel one of the biggest problems you have is the issue of knowing the terminology of the FAQ Manager. It is certainly tricky to get two extras to work together. Its also possible that another search extra could help.

Its also possible that your specific requirements may end up causing a lot more work. Could you simplify them?

I thought you were able to search the FAQs? Can you confirm you can search them successfully? If so we can possibly focus in on the next step.