More information
See the following how-to articles:- Adding Twitter and YouTube Results
- Changing the Color Scheme
- Changing the Logo
- Dynamically Adding Icons to Fields
- Removing the Security Module
- Setting Up a Mock Platform Response
Adding Twitter and YouTube Results
Adding Twitter and YouTube Results
To add Twitter and Youtube results to the page, you must follow five steps.If you are running a local server, then you must restart. Restarting the app-studio script pulls down any new library dependencies.You can adjust the If embedding a YouTube video player like in the above example, you must also add the YouTube domain as a trusted site. To do this, add the following code to the After adding the above block, the entire
1. Get the platform authentication keys
To get Twitter oAuth keys visit the Twitter dev site for Single User OAuth tokens. To get a Youtube API key visit the Google Developers Console, register an application and generate keys.2. Add the dependencies of the YouTube and Twitter platform.
Add the following dependencies to the/pom.xml
file at the root of your project3. Add configuration files
Because both the Youtube and Twitter platforms take various oAuth and API keys, it is advised to keep these in centralized configuration files. Create these files:src/main/resources/conf/platforms/twitter.conf
src/main/resources/conf/platforms/youtube.conf
4. Configure platform, query and response in your View
Next configure a platform, query, and response at the top of the page, as you would do with a standard search. You can copy/paste the below:results-per-page
to taste based on the number of results you want.
Currently both queries are set to search based on the current query (parameters="*"
). Set this to an empty string to return just the latest videos/tweets accordingly.5. Show results on the page
Add the following code to the same page where the platform, query and response were defined in the previous step:/src/main/webapp/search/app/app.js
file after the controller definitions:/src/main/webapp/search/app/app.js
file should look similar to the following:Changing the Color Scheme
Changing the Color Scheme
The principle colors used in the theme are define at the top of Change the
styles/includes/theme.less
:@color-primary
, @color-secondary
, and @color-tertiary
variables to the desired color.For more precise control, the color of individual elements can be controlled in the styling partial stylesheets found in styles/includes/
.Changing the Logo
Changing the Logo
To change the logo
- Prepare both a large and a small version of the logo. The large version should be at least 400 pixels wide; the small version should be 42 pixels tall, and no wider than 225 pixels. It is recommended to save the logos as transparent 24-bit PNGs. Place the two image files in the
assets
folder. - Update the image path in
webapp/login.jsp
(if present) for the large version of the logo. You can also adjust the width of the image tag at the same time. - Update the path in the
<layout:logo>
tag which is usually placed withinwebapp/views/partials/header.tpl.html
for the small version of the logo.
Dynamically Adding Icons to Fields
Dynamically Adding Icons to Fields
Dynamically Adding An Icon To A Field
Sometimes you might want to dynamically prepend a field with an image or an icon depending on the value of a field or variable.This can easily be accomplished using aclass
attribute referencing a little bit of CSS, defined in your styles/includes/custom.less.For example, to dynamically add a ‘type’ image before a field:Removing the Security Module
Removing the Security Module
These steps are required to remove the security module from a project.
You must also remove any other module that depends on the security module such as the Collaboration module.
1. POM
Remove the security module dependency (and any other module that requires security) frompom.xml
:2. Configuration
Replace the security module specified in conf/resources/security/security.conf withtype: generic
3. Web.xml application descriptor
You must remove any reference to the Spring security filters and listeners from yourweb.xml
application descriptor. For example:4. Java code
If you are using any classes from the security Module in Java code, remove references to these. For example, if theSecurityModule
is installed in a custom module, you would remove these references:5. Security configuration files
Optionally, remove thespring-security.xml
configuration file.Setting Up a Mock Platform Response
Setting Up a Mock Platform Response
In some cases it can be difficult to access a search platform. In these situations, it can be useful to work against a static response in the form of a file containing a typical search response (usually as XML).This is not a recommended method for developing a fully featured search application from start to finish, because it is impossible to emulate the dynamic nature of a live platform. However this is useful in a number of situations including:
- Where networking or security considerations prevent access to the platform
- Debugging issues in an application where it is necessary to recreate a specific type of response
- Initial development phases where access to a live platform with realistic data is unavailable
- Deterministic test conditions (this could be for unit tests as well as any other form of manual or automated testing)
How to set up a mock platform
A few simple steps are required to run an application against a ‘mock’ response:- Create a mock response file by saving the XML from a query issued directly against the platform, or request one from someone who can access a platform instance. This should represent the type of response you want to mock. See this example of a Solr XML response:
- Copy the XML file into your project to:
- Modify the URL rules configuration to add a rule that emulates the path at which the search platform interface exists. For example:
- Configure the platform host to point to the relevant URL: