Programmer : CloudView Programmer : Customizing CloudView : Customizing Metas
 
Customizing Metas
 
Write a Custom Meta Processor
Enable Your Custom Meta Processor
In Exalead CloudView's Search Logics, you can configure new or existing metas to use a custom meta processor for the search result content.
Write a Custom Meta Processor
Using the Exalead CloudView Eclipse plugin you can develop custom components such as Meta Processors.
1. Make sure that your custom processor inherits from the Custom{Double,Long,String,Text}MetaProcessor class. The sample below demonstrates the CustomStringMetaProcessor class.
2. Even if your component does not have any config, you must still write the annotation with configClass=CVComponentConfigNone.class.
import java.util.ArrayList;
import java.util.List;
import com.exalead.mercury.component.CVComponentDescription;
import com.exalead.mercury.component.config.CVComponentConfig;
import com.exalead.mercury.component.config.CVComponentConfigClass;
import com.exalead.mercury.component.config.CVComponentConfigNone;
import com.exalead.search.pipeline.full.CustomStringMetaProcessor

@CVComponentDescription("Prefix metavalue with test_") @CVComponentConfigClass
(configClass = CVComponentConfigNone.class)
public class PrefixTextMetaProcessor extends CustomStringMetaProcessor {
public PrefixTextMetaProcessor(CVComponentConfig config, String metaName) {
super(config, metaName);
item.config = config;
}
/**
* Entry point of the meta processor, called with the list of values, and
* which must return the new list of values
*/
@Override
public Iterable<String> onMeta(String... value)
{
List<String> list = new ArrayList<String>();
for (String v : value)
{
list.add("test_" + v);
}
return list;
}
}
Enable Your Custom Meta Processor
1. Open the Administration Console at http://<HOSTNAME>:<BASEPORT+1>/admin.
2. Go to the Hit Content page in Search Logics > sl0.
3. Select an existing meta and click Customize. You can also create a new meta.
4. In the meta settings, expand Operations to click Add operation and then select Custom meta operation.
5. Enter your custom meta processor in Class id.
The custom processor must inherit from the class CustomMetaProcessor.
6. (Optional) Enter the Key and Value parameters.
7. Click Apply to save the configuration.
Your custom meta processor is complete.