Jump to content

[deprecated] RockFinder1


bernhard

Recommended Posts

56 minutes ago, dragan said:

a) I can't get any RF output (arrays, objects) to play nice with PW's pagination / renderPager(). I guess pagination expects a PageArray, not just any kind of array. I know RF was never meant to be used in the frontend, but I tried anyway (and of course, I know building my own pagination with something like Tabulator is quite easy). I just wanted to compare an existing page (how much speed I would gain using RF instead of native PF find).

There's nothing wrong with using RF for the frontend, but you are right, pagination was not on my list. And I don't think we will ever need it for RockFinder, because if you are using pagination, you can use native PW find operations without any performance drawback.

59 minutes ago, dragan said:

url is not recognized. I guess because a PW page URL is not stored inside the DB as-is, but is created when calling the $page->url() method. Am I correct? (PW has to assemble parents(s), page-names etc.)

Exactly, that's why I implemented the callback feature where you can use the PW API to get any properties of your page via PHP: 

 

Link to comment
Share on other sites

Another option could be to build a redirect page, eg mysite.com/?id=1234 that redirects to this page, eg mysite.com/myparent/mypage - then you can easily and efficiently build your links via the ID property.

Link to comment
Share on other sites

@Lutz True. But maybe I'll have another setup where I need to query pages that live under different parents, and (theoretically) also could have identical page-names.

@bernhard Now that sounds both easy and awesome (plus "safe", in the sense that a page ID is always unique, while page-names aren't - unless they are children under the same parent page).

I've been playing a bit more with RF... pure awesomeness and fun. Together with Lazy Cron, Tabulator.js and RF, a small test-setup runs incredibly fast. (Lazy Cron to store the RF-output - JSON - once a day). Makes me almost sad I currently don't have a real use-case / client-project to use all this...

Link to comment
Share on other sites

43 minutes ago, dragan said:

@bernhard Now that sounds both easy and awesome (plus "safe", in the sense that a page ID is always unique, while page-names aren't - unless they are children under the same parent page).

Yeah - I've too often had to build complicated RockFinder queries and came up with this quick&easy solution one day and couldn't believe I didn't think of it earlier ?

45 minutes ago, dragan said:

I've been playing a bit more with RF... pure awesomeness and fun. Together with Lazy Cron, Tabulator.js and RF, a small test-setup runs incredibly fast. (Lazy Cron to store the RF-output - JSON - once a day). Makes me almost sad I currently don't have a real use-case / client-project to use all this...

Don't tell anybody, but I've just started developing RockFinder2 with a new syntax that will be even easier to use and more intuitive and powerful ? 

  • Like 7
  • Thanks 1
Link to comment
Share on other sites

19 hours ago, bernhard said:

Don't tell anybody

I won't ???

I just realized the "view" link in the RF Tester (zooming glass icon) seems to be hard-coded: it's assuming my PW backend is "admin". This should probably be defined dynamically instead (or at least configurable).

Also, I noticed the div.paginationPageSize is always showing "undefined" o_O

  • Like 1
Link to comment
Share on other sites

12 minutes ago, dragan said:

I just realized the "view" link in the RF Tester (zooming glass icon) seems to be hard-coded: it's assuming my PW backend is "admin".

Thx, fixed in 1.1.5

12 minutes ago, dragan said:

Also, I noticed the div.paginationPageSize is always showing "undefined" o_O

True, but I won't fix this as it's not critical and I want to focus on RockFinder2 + RockTabulator ? 

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

Is there an efficient way to get the template name or at least the template ID in the RockFinder results? I'm doing a query for all children of a particular page and those children can have different templates and I need to know which template each page has.

Excellent module btw ?

Link to comment
Share on other sites

Hi @Marc Thx for that interesting question!

I've pushed a little update so that RockFinder takes a DatabaseQuerySelect object as find() parameter. You can then add your find as a relation to your finder:

NLqnwDt.png

Spoiler

$rf = new RockFinder2();
$rf->find("name=cat-50|dog-50");
$rf->addColumns(['title', 'templates_id']);

$query = new DatabaseQuerySelect();
$query->select('id,name');
$query->from('templates');
$templates = new RockFinder2();
$templates->find($query);
$rf->addRelation('templates', $templates);

db($rf);

 

Relations can be great for options fields or 1:n relationships. In this case we have 1:1 so a join would maybe make more sense (though have in mind that this creates one more row in the main resultset, so if you had 1000 rows that would mean 1000 more data items whereas in the relation it would be only the number of the templates).

You can join ANY sql to your initial finder quite easily. First analyze the query and resulting SQL:

7yp4n2n.png

We need two things:

1) LEFT JOIN the data
2) SELECT the column we need in the base query

UXJOw98.png

Voila ?

1yq7rX2.png

  • Like 5
Link to comment
Share on other sites

I would like to try this out so I have just downloaded RockFinder2 from github, however even the simplest test won't work for me:

$rf = new RockFinder2();
$rf->find("parent=1");
$rf->addColumns(["title"]);

Using this on the front end, it generates the error "Uncaught Error: Call to a member function __invoke() on null in /site/modules/RockFinder2/RockFinder2.module.php:746". Also getting this notice: "Trying to get property of non-object in /site/modules/RockFinder2/RockFinder2.module.php on line 801"

RockFinder1 is working properly.

Link to comment
Share on other sites

16 hours ago, bernhard said:

Does it work in the backend? Do you have the latest version (git pull)? It looks like $RockFinder2 api variable is not available for you, but it should (the module is autoload).

You are correct, RockFinder2 was not available. I installed the module and ignored the TracyDebugger dependency warning. Since it DID successfully install ProcessRockFinder2, I assumed everything was alright. Anyway, I installed the debugger and reinstalled RockFinder2 and now it's up and running. Silly mistake on my part and sorry for bothering you about this!

I got your example of including the template name working, thanks for your help! I hope you won't mind if I ask you another question. The docs for RockFinder2 briefly mention repeaters, and state that columns musts be defined manually. What exactly do you mean by this? Could you provide an example? With RockFinder1 you can do $finder->addField("repeatername", ["fieldname"]) but this is no longer the case with RockFinder2.

Link to comment
Share on other sites

I haven't had a look into repeaters yet. I'm avoiding them at all for all my projects as they brought up several problems (especially for finding data via RockFinder). I have a lot more control using regular pages for that tasks and using RockGrid / RockTabulator for presentation and as GUI.

Though it should be quite easy to support Repeaters. That's what the concept of relations is for. The column would list the page ids of the repeater pages and the relations would hold the data of those pages (using regular RockFinder2 syntax $repeater->addColumns(['foo', 'bar'])).

If you need further help you can PM me.

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...