Cockpit cms with Search (Detektivo + TNTSearch)

PIN

Hello, how are you?

This is a simple explanation for people who, like me, did not understand how this search system works because after installing it, what happens?

Come on!

After your project is installed.

Download Detektivo and apply it in the Addons folder:

Once applied, we will create a folder called “Config” and create a “config.yaml” file:

Configured in this way, we will explain what happens:

detektivo: #Calling to detektivo
engine: tntsearch #using the tntsearch
collections: #named the collections you need create a index for it
#this collection i just need found the name
businessunit: [name]
#this collection i will search for name or description
occupation: [name, description]

After these steps, we need to get KEY to create our search like this link:

http://YOURLOCALHOST:0000/api/detektivo/collection/YOUR-COLLECTION?token=YOUR-TOKEN&q=SEARCHS-TRING

API Access:

Generate Token and save and copy 😉

Even this part we already know because it is in the configuration, but then, what happens if I already have items registered on my site?

So!

You should re-register the items, because when you install Detektivo with TNTSearch it, automatically used the first time will create a folder called TNTINDEX inside the STORAGE folder:

PHP code where it creates this folder:

Step by step:

Frist: Dont edit this archive, but you can to change the tntindex folder name.

Here on _construct they will create a “tntindex” folder if dont exists, then, when the folder created, the storage name is the same, the driver to found this will be SQLITE (Remenber its a fast search, if you use in your project MONGODB dont worry, youd database is mongodb but your fast search will be SQLITE)

Then on search function, every time tntsearch will look to your “tntindex” folder to look if you have a .index document, exemple:

posts.index (this document will be created when you save something on your project after this installation). Every new post saved will create on this archive a new index to found and show to you the ID.

Image of the folder created:

And every time you create a new record for your system, it will update this .index file to serve as an index of your search, facilitating and speeding up the search process and when you decide to click on the front end of what was found , normally make the API call to open this item.

*Dont need download the TNTSEARCH

Thanks 😉

Leave Your Comments