You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2011/02/10 14:51:57 UTC
svn commit: r1069391 - in /incubator/stanbol/trunk:
enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/
enhancer/launchers/full/src/main/bundles/ entityhub/
entityhub/jersey/src/main/java/org/apache/stan...
Author: rwesten
Date: Thu Feb 10 13:51:56 2011
New Revision: 1069391
URL: http://svn.apache.org/viewvc?rev=1069391&view=rev
Log:
STANBOL-63: Refactoring the solrProvider and the embeddedSolrProvider bundle back into the bundle of the SolrYard (as discussed on the stanbol-dev list)
In addition this includes three fixes for bugs discovered while testing Stanbol after the refactoring
- forgot to add '[' to the list of chars that need to be escaped for SolrSearches
- SolrYard now replaces ' ' with '+' for EQUALS searches. Only by doing that it can be assured that Solr only returns results that exactly match the parsed String
- The ReferencedSiteEnhancementEngine was replacing ' ' with '+' for query strings. This was effectively a workaround for the bug described above
Added:
incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/embedded/
- copied from r1068869, incubator/stanbol/trunk/entityhub/yard/embeddedSolrProvider/src/main/java/org/apache/stanbol/entityhub/yard/solr/embedded/
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrServerProvider.java (props changed)
- copied unchanged from r1068869, incubator/stanbol/trunk/entityhub/yard/solrProvider/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrServerProvider.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/provider/
- copied from r1068869, incubator/stanbol/trunk/entityhub/yard/solrProvider/src/main/java/org/apache/stanbol/entityhub/yard/solr/provider/
incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/
- copied from r1068869, incubator/stanbol/trunk/entityhub/yard/solrProvider/src/main/resources/META-INF/
Removed:
incubator/stanbol/trunk/entityhub/yard/embeddedSolrProvider/
incubator/stanbol/trunk/entityhub/yard/solrProvider/
Modified:
incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java
incubator/stanbol/trunk/enhancer/launchers/full/src/main/bundles/list.xml
incubator/stanbol/trunk/entityhub/launchers/sling/src/main/bundles/list.xml
incubator/stanbol/trunk/entityhub/pom.xml
incubator/stanbol/trunk/entityhub/yard/solr/pom.xml
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/constraintEncoders/AssignmentEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/services/org.apache.stanbol.entityhub.yard.solr.provider.SolrServerProvider
Modified: incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/enhancer/engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java Thu Feb 10 13:51:56 2011
@@ -271,7 +271,7 @@ public class ReferencedSiteEntityTagging
log.debug("Process TextAnnotation " + name + " type=" + type);
FieldQuery query = site.getQueryFactory().createFieldQuery();
//replace spaces with plus to create an AND search for all words in the name!
- query.setConstraint(nameField, new TextConstraint(name.replace(' ', '+')));
+ query.setConstraint(nameField, new TextConstraint(name));//name.replace(' ', '+')));
if (OntologicalClasses.DBPEDIA_PERSON.equals(type)){
if (personState){
if (personType!=null){
Modified: incubator/stanbol/trunk/enhancer/launchers/full/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/launchers/full/src/main/bundles/list.xml?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/launchers/full/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/enhancer/launchers/full/src/main/bundles/list.xml Thu Feb 10 13:51:56 2011
@@ -361,26 +361,11 @@
<artifactId>org.apache.stanbol.entityhub.yard.clerezza</artifactId>
<version>0.1-SNAPSHOT</version>
</bundle>
- <!-- The SolrYard requires also the solr.provider bundle. In addition
- the solr.embedded bundle can be added to support the use of
- embedded SolrServer -->
<bundle>
<groupId>org.apache.stanbol</groupId>
<artifactId>org.apache.stanbol.entityhub.yard.solr</artifactId>
<version>0.1-SNAPSHOT</version>
</bundle>
- <bundle>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.yard.solr.provider</artifactId>
- <version>0.1-SNAPSHOT</version>
- </bundle>
- <bundle>
- <!-- optional SolrProvider implementation that adds support for
- EmbeddedSolrServer -->
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.yard.solr.embedded</artifactId>
- <version>0.1-SNAPSHOT</version>
- </bundle>
</startLevel>
<startLevel level="16">
<bundle>
Modified: incubator/stanbol/trunk/entityhub/launchers/sling/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/launchers/sling/src/main/bundles/list.xml?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/launchers/sling/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/entityhub/launchers/sling/src/main/bundles/list.xml Thu Feb 10 13:51:56 2011
@@ -144,26 +144,11 @@
<artifactId>org.apache.stanbol.entityhub.yard.clerezza</artifactId>
<version>0.1-SNAPSHOT</version>
</bundle>
- <!-- The SolrYard requires also the solr.provider bundle. In addition
- the solr.embedded bundle can be added to support the use of
- embedded SolrServer -->
<bundle>
<groupId>org.apache.stanbol</groupId>
<artifactId>org.apache.stanbol.entityhub.yard.solr</artifactId>
<version>0.1-SNAPSHOT</version>
</bundle>
- <bundle>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.yard.solr.provider</artifactId>
- <version>0.1-SNAPSHOT</version>
- </bundle>
- <bundle>
- <!-- optional SolrProvider implementation that adds support for
- EmbeddedSolrServer -->
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.yard.solr.embedded</artifactId>
- <version>0.1-SNAPSHOT</version>
- </bundle>
</startLevel>
<startLevel level="16">
<bundle>
Modified: incubator/stanbol/trunk/entityhub/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/pom.xml?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/pom.xml (original)
+++ incubator/stanbol/trunk/entityhub/pom.xml Thu Feb 10 13:51:56 2011
@@ -58,8 +58,5 @@
<!-- Utils for createing local caches (indexing utils) -->
<module>indexing/geonames</module>
<module>indexing/genericRdf</module>
- <!-- Modules for SolrServer providers (used by the SolrYard) -->
- <module>yard/solrProvider</module>
- <module>yard/embeddedSolrProvider</module>
</modules>
</project>
Modified: incubator/stanbol/trunk/entityhub/yard/solr/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/pom.xml?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/pom.xml (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/pom.xml Thu Feb 10 13:51:56 2011
@@ -62,23 +62,36 @@
<instructions>
<Export-Package>
org.apache.stanbol.entityhub.yard.solr;version=${pom.version},
+ org.apache.stanbol.entityhub.yard.solr.defaults;version=${pom.version},
org.apache.stanbol.entityhub.yard.solr.model;version=${pom.version},
org.apache.stanbol.entityhub.yard.solr.query;version=${pom.version},
- org.apache.stanbol.entityhub.yard.solr.utils;version=${pom.version},
- org.apache.stanbol.entityhub.yard.solr.defaults;version=${pom.version}
+ org.apache.stanbol.entityhub.yard.solr.provider;version=${pom.version},
+ org.apache.stanbol.entityhub.yard.solr.utils;version=${pom.version}
</Export-Package>
+ <!-- NOTE: The exclusion of javax.xml.stream assumes that only serialised
+ java objects are used as serialisation to and from the SolrServer
+ and therefore no XML API is needed -->
<Import-Package>
- !org.apache.lucene.*,
!junit.*,
!org.junit.*,
+ !org.mortbay.jetty.*,
+ !org.mortbay.log,
+ !com.sun.msv.*,
+ !org.relaxng.datatype,
+ !javax.xml.stream,
*
</Import-Package>
<Private-Package>
org.apache.stanbol.entityhub.yard.solr.impl;version=${pom.version},
+ org.apache.stanbol.entityhub.yard.solr.embedded;version=${pom.version},
org.apache.stanbol.entityhub.yard.solr.impl.constraintEncoders;version=${pom.version}
</Private-Package>
<Embed-Dependency>
-
+ solr-solrj,commons-httpclient,
+ solr-core, solr-commons-csv,
+ lucene-core, lucene-analyzers, lucene-highlighter, lucene-memory,
+ lucene-spellchecker, lucene-misc, lucene-queries, lucene-snowball,
+ stax-api,wstx-asl
</Embed-Dependency>
</instructions>
</configuration>
@@ -92,6 +105,7 @@
</build>
<dependencies>
+ <!-- Stanbol Entityhub internal dependencies -->
<dependency>
<groupId>org.apache.stanbol</groupId>
<artifactId>org.apache.stanbol.entityhub.servicesapi</artifactId>
@@ -102,16 +116,118 @@
<artifactId>org.apache.stanbol.entityhub.core</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
+ <!-- SolrJ dependencies (needed for using remote Solr servers) -->
<dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.yard.solr.provider</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-solrj</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+
+ <!-- Solr/Lucene dependencies (needed for using embedded Solr servers) -->
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-core</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-highlighter</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-memory</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-misc</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-queries</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-snowball</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-memory</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-spellchecker</artifactId>
+ <version>2.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-commons-csv</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
</dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.7</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
</dependency>
+<!-- <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ <scope>runtime</scope>
+ </dependency> -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
@@ -129,6 +245,18 @@
</exclusion>
</exclusions>
</dependency>
+ <!--
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <version>1.0.4</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.foundation</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency> -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
@@ -139,7 +267,6 @@
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
-
<!-- for tests -->
<dependency>
<groupId>org.apache.stanbol</groupId>
@@ -148,12 +275,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.yard.solr.embedded</artifactId>
- <version>0.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
Propchange: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrServerProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/constraintEncoders/AssignmentEncoder.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/constraintEncoders/AssignmentEncoder.java?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/constraintEncoders/AssignmentEncoder.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/constraintEncoders/AssignmentEncoder.java Thu Feb 10 13:51:56 2011
@@ -42,7 +42,10 @@ public class AssignmentEncoder implement
}
String eqConstraint = EQ;
if(value != null){
- eqConstraint = EQ+(SolrUtil.escapeSolrSpecialChars(indexValue.getValue()));
+ String escapedValue = SolrUtil.escapeSolrSpecialChars(indexValue.getValue());
+ //now we need to replace spaces with '+' because only than the query
+ //is treated as EQUALS by solr
+ eqConstraint = EQ+escapedValue.replace(' ', '+');
}
constraint.addEncoded(POS, eqConstraint);
}
Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java?rev=1069391&r1=1069390&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java Thu Feb 10 13:51:56 2011
@@ -6,7 +6,7 @@ import java.util.regex.Pattern;
public class SolrUtil {
- private static final String LUCENE_ESCAPE_CHARS = "[\\\\+\\-\\!\\(\\)\\:\\^\\]\\{\\}\\~\\*\\?]";
+ private static final String LUCENE_ESCAPE_CHARS = "[\\\\+\\-\\!\\(\\)\\:\\^\\[\\]\\{\\}\\~\\*\\?]";
private static final Pattern LUCENE_PATTERN = Pattern.compile(LUCENE_ESCAPE_CHARS);
private static final String REPLACEMENT_STRING = "\\\\$0";
Modified: incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/services/org.apache.stanbol.entityhub.yard.solr.provider.SolrServerProvider
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/services/org.apache.stanbol.entityhub.yard.solr.provider.SolrServerProvider?rev=1069391&r1=1068869&r2=1069391&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/services/org.apache.stanbol.entityhub.yard.solr.provider.SolrServerProvider (original)
+++ incubator/stanbol/trunk/entityhub/yard/solr/src/main/resources/META-INF/services/org.apache.stanbol.entityhub.yard.solr.provider.SolrServerProvider Thu Feb 10 13:51:56 2011
@@ -1 +1,2 @@
-org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrServerProvider
\ No newline at end of file
+org.apache.stanbol.entityhub.yard.solr.impl.DefaultSolrServerProvider
+org.apache.stanbol.entityhub.yard.solr.embedded.EmbeddedSolrPorovider
\ No newline at end of file