Setting up your development environment
In this chapter you will create, buid, deploy and run a collector based on a template.
Collectors are implemented as standard Enonic applications. This chapter will guide you through the basic steps of building your own custom collector.
|The following steps will require Enonic CLI to be installed
A sandbox is a local developer instance of our platform - Enonic XP.
Create a sandbox called
mycollectorby running this command in your terminal:
enonic sandbox create mycollector
Choose the latest version of Enonic XP (default).
Start the sandbox with this command:
enonic sandbox start --dev mycollector
|Dev mode is used to automatically load changes in your code when developing.
From a new terminal window, run the following command to create the application.
enonic project create -r starter-collector
|Choose the sandbox created in the previous step (if you have multiple sandboxes).
This command uses the Collector starter Github repo as a starter (template) for the app.
From the app folder you created (i.e.
myproject/), run this command:
enonic project deploy
The application should now compile, and deploy to the sandbox.
Log into the Enonic Admin
Open a web broswer and access the Enonic XP Dashboard at http://localhost:8080, then click LOG IN AS GUEST, this will sign you in with super user pemissions.
To actually use your new collector you also need to install Explorer itself.
Applicationsand click Install.
Find Explorer in the list and click the Install button.
With Explorer installed, you can open the Explorer admin from the XP menu:
To try out the new collector, click the hamburger menu and select Collections.
Click the green bottom-right Create collection + button. Fill in a name and select a Default language for the collection. For instance en-US.
Sample collectorin the collector dropdown.
After selecting the collector, a simple form will appear. This form was bundled with your collector and can be customized to your needs. As you will see laster.
Fill in the URL field with this value:
Save the new collection.
Its time to give the collector a spin. From the collections list, simply click the green cloud download icon.
This will start the task in the collector app, fetch and index the page of the URL you filled in above.
It should complete within seconds, and the document count should increase to
If you don’t see any changes, try refreshing, check the sandbox logs, or visit the
Journalmenu items - located just below
Collectionsin the menu.
Now that you have a collection with a document, you may search for it from the Documents page.
To limit the search to a single collection, open the Collections page and click the number in the Documents column. This will open the Documents page with a filter for that collection.
Fill in a search term in the search input. For instance "example" and hit Enter.
You should now get a search result with the document and the word you searched for highlighted.
If you search for a word that isn’t in the document, the search result should be empty.
Now that you have your app up and running, it’s time to dive into the details.
Continue to the overview chapter.