1
|
package eu.etaxonomy.cdm.persistence.dao.common;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
6
|
|
7
|
public interface ISearchableDao<T extends CdmBase> {
|
8
|
|
9
|
/**
|
10
|
* Returns a count of T instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
|
11
|
*
|
12
|
* @param queryString
|
13
|
* @return a count of the matching entities
|
14
|
* @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
|
15
|
*/
|
16
|
public int count(String queryString);
|
17
|
|
18
|
/**
|
19
|
* Returns a List of T instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
|
20
|
*
|
21
|
* @param queryString
|
22
|
* @param pageSize The maximum number of entities returned (can be null for all matching entities)
|
23
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
24
|
* @return a List T instances
|
25
|
* @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
|
26
|
*/
|
27
|
public List<T> search(String queryString, Integer pageSize, Integer pageNumber);
|
28
|
|
29
|
/**
|
30
|
* Suggest a query that will return hits based upon an existing lucene query string (that is presumably misspelt and returns no hits)
|
31
|
* Used to implement "did you mean?"-type functionality using the lucene spellchecker.
|
32
|
*
|
33
|
* @param string Query string to check
|
34
|
* @return a suggested query string that will return hits or null if no such alternative spelling can be found.
|
35
|
*/
|
36
|
public String suggestQuery(String string);
|
37
|
|
38
|
/**
|
39
|
* Removes all TaxonBase entities from the index
|
40
|
*/
|
41
|
public void purgeIndex();
|
42
|
|
43
|
/**
|
44
|
* Index all T entities currently in the database (useful in concert with purgeIndex() to (re-)create
|
45
|
* indexes or in the case of corrupt indexes / mismatch between
|
46
|
* the database and the free-text indices)
|
47
|
*/
|
48
|
public void rebuildIndex();
|
49
|
|
50
|
/**
|
51
|
* Calls optimize on the relevant index (useful periodically to increase response times on the free-text search)
|
52
|
*/
|
53
|
public void optimizeIndex();
|
54
|
}
|