Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-2219 Move scoped analyzers to SPI
This is required in order to enable indexing services to define their own analyzer type, with custom data.
- Loading branch information
Showing
27 changed files
with
286 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
engine/src/main/java/org/hibernate/search/analyzer/impl/ScopedAnalyzer.java
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
engine/src/main/java/org/hibernate/search/analyzer/impl/ScopedLuceneAnalyzerReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.analyzer.impl; | ||
|
||
import org.hibernate.search.analyzer.spi.AnalyzerReference; | ||
import org.hibernate.search.analyzer.spi.ScopedAnalyzerReference; | ||
import org.hibernate.search.util.impl.ScopedLuceneAnalyzer; | ||
|
||
/** | ||
* @author Yoann Rodiere | ||
*/ | ||
public class ScopedLuceneAnalyzerReference extends LuceneAnalyzerReference implements ScopedAnalyzerReference { | ||
|
||
public ScopedLuceneAnalyzerReference(ScopedLuceneAnalyzer analyzer) { | ||
super( analyzer ); | ||
} | ||
|
||
@Override | ||
public ScopedLuceneAnalyzer getAnalyzer() { | ||
return (ScopedLuceneAnalyzer) super.getAnalyzer(); | ||
} | ||
|
||
@Override | ||
public <T extends AnalyzerReference> boolean is(Class<T> analyzerType) { | ||
return analyzerType.isAssignableFrom( ScopedLuceneAnalyzerReference.class ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
engine/src/main/java/org/hibernate/search/analyzer/impl/ScopedRemoteAnalyzerReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.analyzer.impl; | ||
|
||
import org.hibernate.search.analyzer.spi.AnalyzerReference; | ||
import org.hibernate.search.analyzer.spi.ScopedAnalyzerReference; | ||
|
||
/** | ||
* @author Yoann Rodiere | ||
*/ | ||
public class ScopedRemoteAnalyzerReference extends RemoteAnalyzerReference implements ScopedAnalyzerReference { | ||
|
||
public ScopedRemoteAnalyzerReference(ScopedRemoteAnalyzer analyzer) { | ||
super( analyzer ); | ||
} | ||
|
||
@Override | ||
public ScopedRemoteAnalyzer getAnalyzer() { | ||
return (ScopedRemoteAnalyzer) super.getAnalyzer(); | ||
} | ||
|
||
@Override | ||
public <T extends AnalyzerReference> boolean is(Class<T> analyzerType) { | ||
return analyzerType.isAssignableFrom( ScopedRemoteAnalyzerReference.class ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
engine/src/main/java/org/hibernate/search/analyzer/spi/ScopedAnalyzer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.analyzer.spi; | ||
|
||
/** | ||
* General interface for scope aware analyzers. | ||
* | ||
* @author Guillaume Smet | ||
* @author Yoann Rodiere | ||
* | ||
* @hsearch.experimental This type is under active development as part of the Elasticsearch integration. You | ||
* should be prepared for incompatible changes in future releases. | ||
*/ | ||
public interface ScopedAnalyzer { | ||
|
||
void close(); | ||
|
||
/** | ||
* @return A builder for copying the referenced analyzer, altering some scopes as necessary. | ||
*/ | ||
Builder startCopy(); | ||
|
||
/** | ||
* Interface for building scope aware analyzers. | ||
* | ||
* @author Guillaume Smet | ||
* @author Yoann Rodiere | ||
* @hsearch.experimental This type is under active development as part of the Elasticsearch integration. You | ||
* should be prepared for incompatible changes in future releases. | ||
*/ | ||
public interface Builder { | ||
AnalyzerReference getGlobalAnalyzerReference(); | ||
|
||
void setGlobalAnalyzerReference(AnalyzerReference globalAnalyzerReference); | ||
|
||
void addAnalyzerReference(String scope, AnalyzerReference analyzerReference); | ||
|
||
ScopedAnalyzerReference build(); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
engine/src/main/java/org/hibernate/search/analyzer/spi/ScopedAnalyzerReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.analyzer.spi; | ||
|
||
/** | ||
* Reference to a scoped analyzer implementation. | ||
* | ||
* @author Davide D'Alto | ||
* | ||
* @hsearch.experimental This type is under active development as part of the Elasticsearch integration. You | ||
* should be prepared for incompatible changes in future releases. | ||
*/ | ||
public interface ScopedAnalyzerReference extends AnalyzerReference { | ||
|
||
@Override | ||
ScopedAnalyzer getAnalyzer(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.