Can I also do the output with Fabrik?

RupertTHEbare

New Member
Our users enter reports into a "jos_forms_incidents" MySQL table via a Fabrik2 entry form.

Now I want to give a class of registered users access to the information contained in the reports and make them searchable.

My idea was to let them search the material as if it was content material/articles via the PixSearch "shell" for the content search engine in Joomla. But that doesn't work as the search engine doesn't know of the table's existence.

What I think I need is a search plugin for the reports table that will index the result to the normal search component, and the results will therefore also turn up in PixSearch (or any other search function that uses com_search).

Here's what the input form looks like. It will give you a rough idea of the size and type of fields in the table.

inputform1.png



If possible, my ideal would be to turn these reports into searchable content somehow.

Or is there some other way to do this with Fabrik?

RTB.
 
Have you tried the "Search - Fabrik" J! plugin?

-- hugh

Not yet. Can you point me to somewhere I can read up on how to use it? I've tried searching the forum but there certainly seems to be a certain amount of uncertainty about that.

At least of that much I am certain... :rolleyes:

RTB.
 
Just enable the "Fabrik - Search" filter in J!'s Plugin manager, then set the Search params on your table (bottom of Publishing tab). The 'field' and 'description' are the elements which will be used on the search results form - it'll actually search all available elements in the table (subject to usual permissions settings).

HOWEVER ... as usual I tested this before posting, and I've found a bug with pre-filters. When we build the WHERE search query, we're using an 'OR' between the pre-filter condition and the element searches ... like this ... "WHERE prefilter_whatever = 'foo' OR (this.element like '%searchword%') OR (this.element2 like '%searchword%') ..."

... which means that if you have a pre-filter, you search will match on that as well as your search terms. We should be using an AND, so you get the intersecting results (where the pre-filter AND the search terms match).

You'd have thought this would be a simple bug to fix, but that part of the code is somewhat devious, so I'll probably leave it to Rob to fix. I can see what I need to change to make the searching work, but the same routine is called from a lot of other places in Fabrik, so I'm worried about introducing unexpected behavior into stuff like filter dropdowns, etc.

-- hugh
 
Just enable the "Fabrik - Search" filter in J!'s Plugin manager, then set the Search params on your table (bottom of Publishing tab).
-- hugh

I have 12 search category plugins in Joomla, Hugh, and none of them have anything to do with Fabrik. Is this a very recent addition to Fabrik2 or did I miss something somewhere?

RTB.
 
the files should be in the SVN - /plugins/search/fabrik.php and /plugins/search/fabrik.xml

you might have to make a zip out of them and install the plugin to get them to show up.
 
the files should be in the SVN - /plugins/search/fabrik.php and /plugins/search/fabrik.xml

you might have to make a zip out of them and install the plugin to get them to show up.

I found them there, took them out and used 7-Zip to make an archive of them. I also tried the same thing with WinZip and got this message when I tried to install them both...

PHP:
Fatal error:  Call to undefined method stdClass::store() in G:\xampp\htdocs\Joomla\libraries\joomla\installer\adapters\plugin.php on line 180
...but only the "fabrik.php" file was put into /plugins/search.

By the way, line 80 is blank, but this is what I see in "plugin.php" at lines 75-91...
PHP:
        /*
         * Backward Compatability
         * @todo Deprecate in future version
         */
        $type = $this->manifest->attributes('type');

        // Set the installation path
        $element =& $this->manifest->getElementByPath('files');
        if (is_a($element, 'JSimpleXMLElement') && count($element->children())) {
            $files =& $element->children();
            foreach ($files as $file) {
                if ($file->attributes($type)) {
                    $pname = $file->attributes($type);
                    break;
                }
            }
        }
When I check, there is no Fabrik search plugin available in either Joomla or Fabrik plugin manager.

Then I thought about it and wondered if you meant install the plugin through Joomla's installation manager, not through the Fabrik plugin manager, which I thought was what you meant, Rob, and I had used.

Anyhoo... bingo! Its now installed.

Only goes to show you how precise you have to be when dealing with the a ninja code warrior...

RTB.
 
Just enable the "Fabrik - Search" filter in J!'s Plugin manager, then set the Search params on your table (bottom of Publishing tab).

-- hugh

Brilliant, Hugh, just what I wanted.

I can live with the "AND" "OR" situation until Rob has time to sort it out but one thing I do have a problem with is that, in the advanced search, I am given a tick box to search "Fabrik/record"and/or other content.

Ideally, I would like to be able to search only the "Fabrik/record" element, which I realise is not a Fabrik issue but your input would be appreciated on resolving this, and (which is a Fabrik issue, I think), I see the tick box defined as "Fabrik/record", which is not going to mean very much to my users.

The table label variable would be a much more useful descriptor I would have thought.

Ninja code warrior hack, or a new feature request?

RTB.
 
Brilliant, Hugh, just what I wanted.

I can live with the "AND" "OR" situation until Rob has time to sort it out

That's been fixed in SVN.

but one thing I do have a problem with is that, in the advanced search, I am given a tick box to search "Fabrik/record"and/or other content.

Ideally, I would like to be able to search only the "Fabrik/record" element, which I realise is not a Fabrik issue but your input would be appreciated on resolving this, and (which is a Fabrik issue, I think), I see the tick box defined as "Fabrik/record", which is not going to mean very much to my users.

The table label variable would be a much more useful descriptor I would have thought.

Well that's why the search plugin lets you set the 'Section Heading'. We just use Fabrik/record as the default.

I think you can restrict what sections it searches by finagling your J! template so it adds &areas[]=fabrik to the URL, or add a hidden post input of the same name.

-- hugh
 
That's been fixed in SVN.

Well that's why the search plugin lets you set the 'Section Heading'. We just use Fabrik/record as the default.

Aha, yes, as you quite rightly spotted... I missed that.

I think you can restrict what sections it searches by finagling your J! template so it adds &areas[]=fabrik to the URL, or add a hidden post input of the same name.

-- hugh

Pppphhhfffffssssttttt!

What was that?

I think it was the rest of your answer passing over my head... ???

RTB.
 
I think it was the rest of your answer passing over my head... ???

OK, step back a bit. How do you actually want to invoke the search, i.e. thru the standard little 'search' box at the top of most J! templates, or do you want to create a special page for it, or what?

-- hugh
 
That's been fixed in SVN.

-- hugh

But after updatng to tonight's SVN, Hugh, I see something else has also crept in, I think it is in line 145 of the search plugin.

I am using PixSearch which is just a shell for Joomla's search but I have also tested Joomla's search too, and the result is the same.

When I now do a search for a word, say "Hilton", I get nothing from PixSearch and the error message below if I use advanced search. When I use Joomla's search I get this error message immediately.

PHP:
SELECT DISTINCT ``.`user_id` AS `jos_form_incidents___user_id_raw`, ``.`` AS
 `jos_form_incidents___user_id`, `jos_form_incidents`.`fabrik_internal_id` AS
 `jos_form_incidents___fabrik_internal_id`, `jos_form_incidents`.`time_date` AS
 `jos_form_incidents___time_date`, `jos_form_incidents`.`customer_name` AS
 `jos_form_incidents___customer_name`, `jos_form_incidents`.`incident_date` AS
 `jos_form_incidents___incident_date`, `jos_form_incidents`.`customer_met` AS
 `jos_form_incidents___customer_met`, `jos_form_incidents`.`incident_type` AS
 `jos_form_incidents___incident_type_raw`, `jos_form_incident_type`.`incident_type` AS
 `jos_form_incidents___incident_type`, `jos_form_incidents`.`incident_country` AS
 `jos_form_incidents___incident_country_raw`, `jos_form_countries`.`countries_name` AS
 `jos_form_incidents___incident_country`, `jos_form_incidents`.`incident_city` AS
 `jos_form_incidents___incident_city`, `jos_form_incidents`.`incident_location` AS
 `jos_form_incidents___incident_location`, `jos_form_incidents`.`incident_description` AS
 `jos_form_incidents___incident_description`, `jos_form_incidents`.`customer_phone` AS
 `jos_form_incidents___customer_phone`, `jos_form_incidents`.`customer_mobile` AS
 `jos_form_incidents___customer_mobile`, `jos_form_incidents`.`customer_email` AS
 `jos_form_incidents___customer_email`, `jos_form_incidents`.`customer_employment` AS
 `jos_form_incidents___customer_employment`, `jos_form_incidents`.`customer_vehicle` AS
 `jos_form_incidents___customer_vehicle`, `jos_form_incidents`.`fabrik_internal_id` ,
 `jos_form_incidents`.`fabrik_internal_id` AS __pk_val FROM `jos_form_incidents` LEFT JOIN
 `jos_form_incident_type` AS `jos_form_incident_type` ON `jos_form_incident_type`.`label` =
 `jos_form_incidents`.`incident_type` LEFT JOIN `jos_form_countries` AS `jos_form_countries`
 ON `jos_form_countries`.`iso` = `jos_form_incidents`.`incident_country` WHERE ( ( ( ``.``
 LIKE '%Hilton%') OR ( `jos_form_incidents`.`fabrik_internal_id` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_name` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_met` LIKE '%Hilton%') OR (
 `jos_form_incident_type`.`incident_type` LIKE '%Hilton%') OR (
 `jos_form_countries`.`countries_name` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`incident_city` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`incident_location` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`incident_description` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_phone` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_mobile` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_email` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_employment` LIKE '%Hilton%') OR (
 `jos_form_incidents`.`customer_vehicle` LIKE '%Hilton%') )) ORDER BY
 `jos_form_incidents`.`fabrik_internal_id` ASC


Warning: Invalid argument supplied for foreach() in G:\xampp\htdocs\Joomla\plugins\
search\fabrik.php on line 145
Golly gee... its dangerous being a ninja code warrior... :p

RTB.
 
OK, step back a bit. How do you actually want to invoke the search, i.e. thru the standard little 'search' box at the top of most J! templates, or do you want to create a special page for it, or what?

-- hugh

Well, the way I had started off thinking I would do it was to simply use Joomla!'s search engine (via PixSearch which shows up instant matches), to display any matching data and use the Fabrik data entry form to display the record content, which is essentially what was happening until SVN 569 rained on my parade.

This is a little akward however, since once you have chosen from the list and clicked on the search engine provided maching data, and it pops up the matching record, and then all the alternative search hits are gone and the search has to be repeated.

I think the best thing would be for a search to throw up a table of records with matching data, into a specific page say, and for those results to remain on that page until each/all of them have either been looked at or discarded.

What would you say the best way to do that would be?

RTB.
 
SVN 574 now produces this from Joomla! search...

PHP:
Warning:  Invalid argument supplied for foreach() in G:\xampp\htdocs\Joomla\plugins\search\fabrik.php on line 148
From my search shell, PixSearch, I get nothing returned in normal search mode and in advanced search I get the same error message.

RTB.
 
The SQL query stuff you were seeing should be gone as of a rev or two ago, that was some debug output Rob was using, now been commented out.

I'm looking at the other issue now.

-- hugh
 
The SQL query stuff you were seeing should be gone as of a rev or two ago, that was some debug output Rob was using, now been commented out.

I'm looking at the other issue now.

-- hugh

Wot you lookin at Willis? O0

By the way... I'm back. Did you miss me? Oh, and my signature will be changing since I am currently setting up and transferring to my own Linux (Centos) box.

RTB.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top