Welcome, Guest
Username: Password: Remember me

TOPIC: New Feature : Search Plugin

New Feature : Search Plugin 21 Mar 2017 13:04 #15050

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Use now the Joomla search module for searching directly on your component datas
You gonna love it..

www.j-cook.pro/index.php/docs/versions/292-3-1-4
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: organicwebs

New Feature : Search Plugin 22 Mar 2017 15:20 #15058

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
concat() function

YAY!
The administrator has disabled public write access.

New Feature : Search Plugin 23 Mar 2017 09:23 #15059

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
  • Karma: 22
I Started to play with this new Search Plugin.
first step (Include Component Area) is on :)


I am now trying to anderstand how the Component Tables are managed for the text Search ...
The administrator has disabled public write access.

New Feature : Search Plugin 23 Mar 2017 12:11 #15060

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Once you put a SEARCH filter (and the fields to search on) in a FRONT list, then the concerned table becomes an AREA
For the moment, the area name is the same name than the table name (plural). But it is possible to extend this feature and create a custom area for whatever search.

The plugin is NOT forkable at the moment.
This plugin is closely linked to your component, using the ORM system which permit to keep locked all the ACCESSES without needing to instance them over again and again.
For sure, this plugin will systematically load the component loader (when the area is selected only), and I don't know precisely the consequences on the page loading, but this was necessary.
Anyone is free to remove the ORM layer and the component loader (manually), for some areas that do not require too much restrictions. In that case, deal with a litteral SQL query in the plugin.
I simply provide you the most difficult work. Then, "use the scissors" and cut it to your needs.

In the sandbox, you can play with it (automatically installed with your component), and check the ACL, published, author.... you will see how beautiful...
Coding is now a piece of cake
The administrator has disabled public write access.

New Feature : Search Plugin 23 Mar 2017 12:27 #15061

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Others tips :
The plugin is querying the concerned model trough the 'plugin.search' context name.
This context automatically find the ormPluginSearch() function in the concerned model (front only)

This is the place for all customs. And it is FORKABLE. The plugin is just a bridge. It is the caller, not the worker.
In future evolution, I will also place the definition of the searchable areas in the component (loader or helper).

I also introduced the concat() function in ORM because the ALL rule of search is requiring it.
The search applies on a list of fields, and all these fields are concatenated directly in the query.

Example : (area : Cities)
Search : "Paris France"
-> The string Paris is found on field 'Name'
-> The string France is found on field 'Country.Name'
I you search ALL, the search will match only when the 2 terms are found. The result is impossible to achieve without concatenation.

To concatenate, use the bracklets (as shown in your component)
{name} {country.name} {country.continent.name}

Another use of concat, is for rendering the text for the search result. Example
City: {name} / Country: {country.name} / Continent: {country.continent.name}

Open your curiosity in the ormPluginSearch() function, all is compacted in few lines.
Now compare with a classical plugin, and then share your comments, lol
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: liubov

New Feature : Search Plugin 23 Mar 2017 12:54 #15062

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
  • Karma: 22
Ho yes OK!
I did not anderstand what this sentence means ! I get it now, thank you.
Once you put a SEARCH filter (and the fields to search on) in a FRONT list, then the concerned table becomes an AREA...
I read the procedure, a have a last question:

Does it works if the search is made from the main Search Module of the site (not only from FRONT List component page) ?
Last Edit: 23 Mar 2017 12:55 by liubov.
The administrator has disabled public write access.

New Feature : Search Plugin 23 Mar 2017 12:58 #15063

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
liubov wrote:
Does it works if the search is made from the main Search Module of the site (not only from FRONT List component page) ?

Yes of course. This is precisely the purpose of the feature.

Achieving this work, the ORM search engine has been improved as well for the component internal searches.
At the moment I write you this I realize that the component search is not using the concat() (yet) and so the results can differs. things can improve (easy to do manually)
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.075 seconds

Get Started