com.gisgraphy.domain.geoloc.service.fulltextsearch
Class FullTextSearchEngine

java.lang.Object
  extended by com.gisgraphy.domain.geoloc.service.fulltextsearch.FullTextSearchEngine
All Implemented Interfaces:
IFullTextSearchEngine, IQueryProcessor<FulltextQuery>

public class FullTextSearchEngine
extends java.lang.Object
implements IFullTextSearchEngine

Default (threadsafe) implementation of IFullTextSearchEngine

Author:
David Masclet

Field Summary
protected static org.slf4j.Logger logger
           
 
Constructor Summary
FullTextSearchEngine(org.apache.commons.httpclient.MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager)
           
 
Method Summary
 void executeAndSerialize(FulltextQuery query, java.io.OutputStream outputStream)
          Execute the query and serialize the results in an OutputStream.
 FulltextResultsDto executeQuery(FulltextQuery query)
          Execute the query and returns a list of DTO
 java.util.List<? extends GisFeature> executeQueryToDatabaseObjects(FulltextQuery query)
          Execute the query and returns the Java Objects.
 java.lang.String executeQueryToString(FulltextQuery query)
          Execute the query and returns the results as String.
 java.lang.String getURL()
           
 boolean isAlive()
           
 void setSolrClient(IsolrClient solrClient)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.slf4j.Logger logger
Constructor Detail

FullTextSearchEngine

public FullTextSearchEngine(@Qualifier(value="multiThreadedHttpConnectionManager")
                            org.apache.commons.httpclient.MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager)
                     throws FullTextSearchException
Parameters:
multiThreadedHttpConnectionManager - The
Throws:
FullTextSearchException - If an error occured
Method Detail

executeAndSerialize

public void executeAndSerialize(FulltextQuery query,
                                java.io.OutputStream outputStream)
                         throws FullTextSearchException
Description copied from interface: IQueryProcessor
Execute the query and serialize the results in an OutputStream. It is thread safe and can be used in a servlet container (e.g : serialize on an HttpResource's OutputStream

Specified by:
executeAndSerialize in interface IQueryProcessor<FulltextQuery>
Parameters:
query - the query to execute
outputStream - the outputstream we want to serialize in
Throws:
FullTextSearchException

executeQueryToString

public java.lang.String executeQueryToString(FulltextQuery query)
Description copied from interface: IQueryProcessor
Execute the query and returns the results as String. It is thread safe

Specified by:
executeQueryToString in interface IQueryProcessor<FulltextQuery>
Parameters:
query - the query to execute

executeQueryToDatabaseObjects

public java.util.List<? extends GisFeature> executeQueryToDatabaseObjects(FulltextQuery query)
                                                                   throws ServiceException
Description copied from interface: IFullTextSearchEngine
Execute the query and returns the Java Objects. The results are nor sorted by relevance

Specified by:
executeQueryToDatabaseObjects in interface IFullTextSearchEngine
Parameters:
query - The FulltextQuery to execute
Returns:
The proxied hibernate Java Objects. Never return null but an empty list
Throws:
ServiceException - If an error occurred

executeQuery

public FulltextResultsDto executeQuery(FulltextQuery query)
                                throws ServiceException
Description copied from interface: IFullTextSearchEngine
Execute the query and returns a list of DTO

Specified by:
executeQuery in interface IFullTextSearchEngine
Parameters:
query - The FulltextQuery to execute
Returns:
a DTO for the results. note : The list of results will never be null but an empty list
Throws:
ServiceException - If an error occurred

isAlive

public boolean isAlive()
Specified by:
isAlive in interface IFullTextSearchEngine
Returns:
true if the fulltextsearchengine is alive, otherwise return false;

setSolrClient

public void setSolrClient(IsolrClient solrClient)
Parameters:
solrClient - the solrClient to set

getURL

public java.lang.String getURL()
Specified by:
getURL in interface IFullTextSearchEngine
Returns:
the url of the fulltextsearch engine


Copyright © 2010. All Rights Reserved.