1
|
/**
|
2
|
* Copyright (C) 2013 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service.search;
|
10
|
|
11
|
import org.apache.lucene.analysis.Analyzer;
|
12
|
import org.apache.lucene.index.IndexReader;
|
13
|
import org.apache.lucene.queryparser.classic.QueryParser;
|
14
|
import org.hibernate.search.indexes.IndexReaderAccessor;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
17
|
|
18
|
/**
|
19
|
* @author a.kohlbecker
|
20
|
\* @since Sep 18, 2013
|
21
|
*
|
22
|
*/
|
23
|
public interface ILuceneIndexToolProvider {
|
24
|
|
25
|
/**
|
26
|
* @return the IndexReader suitable for the lucene index of the given
|
27
|
* <code>clazz</code>
|
28
|
*/
|
29
|
public abstract IndexReader getIndexReaderFor(Class<? extends CdmBase> clazz);
|
30
|
|
31
|
/**
|
32
|
* Either creates a new QueryParser or returns the QueryParser which has
|
33
|
* been created before for the specified class. The QueryParsers per CdmBase
|
34
|
* type are cached in a Map.
|
35
|
* @param complexPhraseQuery TODO
|
36
|
*
|
37
|
* @return the QueryParser suitable for the lucene index of the given
|
38
|
* <code>clazz</code>
|
39
|
*/
|
40
|
public abstract QueryParser getQueryParserFor(Class<? extends CdmBase> clazz, boolean complexPhraseQuery);
|
41
|
|
42
|
/**
|
43
|
* <b>WARING</b> The implementation of this method might return an Analyzer
|
44
|
* which is not suitable for all fields of the lucene document. This method
|
45
|
* internally uses the simplified method from {@link {
|
46
|
* @link org.hibernate.search.SearchFactory#getAnalyzer(Class)}
|
47
|
*
|
48
|
* @return the Analyzer suitable for the lucene index of the given
|
49
|
* <code>clazz</code>
|
50
|
*/
|
51
|
public abstract Analyzer getAnalyzerFor(Class<? extends CdmBase> clazz);
|
52
|
|
53
|
/**
|
54
|
* Creates new QueryFactory for the specified Cdm type.
|
55
|
*
|
56
|
* @return A new QueryFactory suitable for the lucene index of the given
|
57
|
* <code>clazz</code>
|
58
|
*/
|
59
|
public abstract QueryFactory newQueryFactoryFor(Class<? extends CdmBase> clazz);
|
60
|
|
61
|
/**
|
62
|
* @return the IndexReaderAccessor from the SearchFactory
|
63
|
*/
|
64
|
public abstract IndexReaderAccessor getIndexReaderAccessor();
|
65
|
|
66
|
}
|