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:
className:fieldName(s):packageName:packagePath:joinCriteria||class2Name:fieldName(s):package2Name:package2Path:join2Criteria
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 = modResource.id
I tried to do this for the FAQ Manager like this:
&customPackages=`faqman:answer:faqman:{core_path}/components/faqman/model/:faqman.resource = modResource.id`
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.
className:
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…
fieldName(s)
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.
packageName
In the example “quip” is used as the packageName, so I have to use “faqman”.
packagePath
In the example “{core_path}components/quip/model/” is used as the packagePath, so I have to use “{core_path}/components/faqman/model/”.
joinCriteria
This one I don’t get right I guess.
In the example “quipComment.resource = modResource.id” 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 = modResource.id`]]
But still no success.
So does anyone has used the customPackages with success and has a hint for me?
Greetings to the forum!