BrightSide Workbench Full Report + Source Code
org.turro.elephant.search.ISearchable Interface Reference
Inheritance diagram for org.turro.elephant.search.ISearchable:

Public Member Functions

FoundList search (String value, boolean ignoreCase)
 

Detailed Description

ISearchable interface must be implemented by all those searchable elements. Elephant's search implentation provides a set of utilities for helping this implementation. The only requirement for an element to be searchable is to implement this interface.

A sample implementation could be:

public FoundList search(String value, boolean ignoreCase) {

 // TODO: Prepare elements to query.

 // Create a FoundList to store concidences.
 FoundList fl = new FoundList();

 // Create a SearchFormatter to check coincidences.
 SearchFormatter sf = new SearchFormatter(value, ignoreCase);

 // Process lines / strings from this element.
 sf.processLine(line);

 // Test whether something was found.
 if(sf.wasFound()) {
   // add the element
   fl.addItem(
       // Identifier
       getId() == null ? "" : getId(),
       // Link to element location
       (context.getPath().length() == 0 ? "/" : context.getPath()) + "#" + resource,
       // Image identifying the element
       "<img src='" + getConstructor().getRootWebPath() + "/_internal/system/images/webpage.gif'/>",
       // Context name
       context.getName(),
       // Result provided by SearchFormatter
       sf.getResult(),
       // Similarity provided by SearchFormatter
       (double)sf.getFound(),
       // Searched value, passed as parameter
       value
     );
 }
 return fl;
}
Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 67 of file ISearchable.java.

Member Function Documentation

◆ search()

FoundList org.turro.elephant.search.ISearchable.search ( String  value,
boolean  ignoreCase 
)

This method is called by Elephant search implementation.

Parameters
valueValue to search.
ignoreCaseWhether to ignore case.
Returns
A list of coincidences.

Implemented in org.turro.elephant.impl.context.DefaultElement, org.turro.elephant.impl.context.DefaultContext, org.turro.publication.www.PublicationWeb, and org.turro.newsletter.NewsletterDashboard.


The documentation for this interface was generated from the following file: