You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by yo...@apache.org on 2006/08/11 00:32:47 UTC
svn commit: r430568 [1/8] - in /lucene/java/trunk/contrib/gdata-server: ./
lib/ src/java/org/apache/lucene/gdata/data/
src/java/org/apache/lucene/gdata/search/
src/java/org/apache/lucene/gdata/search/analysis/
src/java/org/apache/lucene/gdata/search/co...
Author: yonik
Date: Thu Aug 10 15:32:40 2006
New Revision: 430568
URL: http://svn.apache.org/viewvc?rev=430568&view=rev
Log:
gdata 2006-08-10 checkin
Added:
lucene/java/trunk/contrib/gdata-server/lib/nekohtml.jar (with props)
lucene/java/trunk/contrib/gdata-server/lib/xercesImpl.jar (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/config/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/config/IndexSchema.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/config/IndexSchemaField.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/config/package.html (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/GDataIndexDocument.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/GDataIndexWriter.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/GDataIndexer.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/GdataIndexerException.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexAction.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexController.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexDocument.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexDocumentBuilder.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexDocumentBuilderTask.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexEventListener.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexLogReader.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexLogWriter.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/IndexTask.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/TimedIndexTask.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/index/package.html (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/package.html (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/query/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/query/GDataQueryParser.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/query/QueryTranslator.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataSearchService.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/EntryEventListener.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/EntryEventMediator.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/ModifiedEntryFilter.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/ReferenceCounter.java (with props)
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/ReflectionUtils.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/TestStandardGdataSearcher.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/IndexableStub.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestContentStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestDomIndexable.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestGdataCategoryStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestGdataDateStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestHTMLStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestKeywordStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestMixedStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/analysis/TestPlainTextStrategy.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/config/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/config/TestIndexSchema.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/config/TestIndexSchemaField.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/FutureStub.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/IndexDocumentStub.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/IndexEventListenerStub.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexDocument.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexWriter.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexer.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexController.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestIndexLogReader.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/index/TestindexDocumentBuilderTask.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestGdataQueryParser.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/search/query/TestQueryTranslator.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestProvidedServiceConfig.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/db4o/TestObjectServerDecorator.java (with props)
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestReflectionUtils.java (with props)
Modified:
lucene/java/trunk/contrib/gdata-server/build.xml
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/FeedNotFoundException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequest.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequestException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataResponse.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataService.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceFactory.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AccountBuilder.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/GDataAdminService.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ComponentType.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/GDataServerRegistry.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ProvidedService.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ProvidedServiceConfig.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryBuilder.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryContextListener.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ServerComponent.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/configuration/ComponentConfiguration.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/configuration/PropertyInjector.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AbstractAccountHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AbstractFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AbstractGdataRequestHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AuthenticationHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultDeleteHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultGetHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultInsertHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultUpdateHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DeleteFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/InsertFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/UpdateFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/db4o/DB4oController.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/db4o/DB4oStorage.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/ModifiedEntryFilter.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageBuffer.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageCoreController.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageImplementation.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageQuery.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/util/ReferenceCounter.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/data/TestGDataUser.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataRequest.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataResponse.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/TestAccountBuilder.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestConfigurationBean.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/configuration/TestPropertyInjector.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/TestAbstractGdataServlet.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestAbstractFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestRequestAuthenticator.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/TestIDGenerator.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/db4o/TestDb4oStorage.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/StorageCoreControllerStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestModifiedEntryFilter.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestSingelHostConcurrencyLock.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestStorageBuffer.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestStorageImplementation.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestStorageModifier.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestStorageQuery.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/TestRecoverController.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/TestRecoverWriter.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/TestRevocerReader.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ProvidedServiceStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ServiceFactoryStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestDateFormater.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestSimpleObjectPool.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/Visitor.java
lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xml
lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xsd
Modified: lucene/java/trunk/contrib/gdata-server/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/build.xml?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/build.xml (original)
+++ lucene/java/trunk/contrib/gdata-server/build.xml Thu Aug 10 15:32:40 2006
@@ -25,11 +25,14 @@
<include name="commons-digester-1.7.jar" />
<include name="commons-beanutils.jar" />
<include name="commons-collections-3.2.jar" />
+ <include name="nekohtml.jar" />
+ <include name="xercesImpl.jar" />
<include name="${db4o.jar}" if="db4o.jar.present" />
- </fileset>
+ </fileset>
</path>
-
- <!-- redefine compile-core and compile-test to exclude 3rd party dependend sources -->
+
+
+ <!-- redefine compile-core and compile-test to exclude 3rd party dependend sources -->
<target name="compile-core" depends="init">
<echo>Use gdata - compile-core task </echo>
<compile srcdir="src/java" destdir="${build.dir}/classes/java">
@@ -74,7 +77,10 @@
<include name="commons-digester-1.7.jar" />
<include name="commons-beanutils.jar" />
<include name="commons-collections-3.2.jar" />
+ <include name="nekohtml.jar" />
+ <include name="xercesImpl.jar" />
<include name="${db4o.jar}" if="db4o.jar.present" />
+
</lib>
<lib dir="${build.dir}" includes="${final.name}.jar" />
<lib file="${lucene.jar}" />
Added: lucene/java/trunk/contrib/gdata-server/lib/nekohtml.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/nekohtml.jar?rev=430568&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/java/trunk/contrib/gdata-server/lib/nekohtml.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/java/trunk/contrib/gdata-server/lib/xercesImpl.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/xercesImpl.jar?rev=430568&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/java/trunk/contrib/gdata-server/lib/xercesImpl.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java?rev=430568&r1=430567&r2=430568&view=diff
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java (original)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java Thu Aug 10 15:32:40 2006
@@ -226,6 +226,8 @@
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object o) {
+ if(this.name == null)
+ return super.equals(o);
if(o == null)
return false;
if (this == o)
@@ -243,6 +245,8 @@
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
+ if(this.name == null)
+ return super.hashCode();
int ret = 37;
ret = 9 * ret + this.name.hashCode();
return ret;
@@ -269,14 +273,14 @@
builder.append(" password: ").append((this.password!= null?" length: "+this.password.length():null));
builder.append(" author: ").append(this.authorname);
builder.append(" author email: ").append(this.authorMail);
- builder.append(" author link: ").append(this.authorLink);
+ builder.append(" author link: ").append(this.authorLink!=null?"":this.authorLink);
return builder.toString();
}
/**
* checks whether the given integer matches the account role.
* @param intRole - integer representation of a role
- * @param role - the accountrole to match
+ * @param role - the account role to match
* @return <code>true</code> if and only if the given roles match, otherwise <code>false</code>
*/
public static boolean isInRole(int intRole, AccountRole role){
@@ -292,7 +296,7 @@
}
/**
- * @return - a new Administartor accoutn
+ * @return - a new Administrator account
*/
public static final GDataAccount createAdminAccount(){
GDataAccount retVal = new GDataAccount();
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.lucene.search.Query;
+
+/**
+ * @author Simon Willnauer
+ * @param <T>
+ *
+ */
+public interface GDataSearcher <T>{
+
+ /**
+ * executes an Query and returns a list of defined return values of type T
+ * @param query - the query to apply to the searcher
+ * @param hitcount - the amount of hits returned by this search
+ * @param offset - the hit count offset
+ * @param feedId
+ * @return List of T
+ * @throws IOException - if the underlying lucene searcher throws an IO Exception
+ */
+ public List<T> search(Query query,int hitcount, int offset, String feedId)throws IOException;
+ /**
+ * Destroys this Searcher
+ */
+ public abstract void close();
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/GDataSearcher.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.search;
+
+import org.apache.lucene.gdata.server.registry.ProvidedService;
+import org.apache.lucene.gdata.server.registry.ServerComponent;
+
+/**
+ * TODO document this when Search comes into play
+ *
+ * @author Simon Willnauer
+ *
+ */
+public interface SearchComponent extends ServerComponent {
+ /**
+ * TODO document this when Search comes into play
+ *
+ * @param service
+ *
+ * @return a GDataSearcher
+ */
+ public abstract GDataSearcher<String> getServiceSearcher(ProvidedService service);
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/SearchComponent.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,132 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.search;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.gdata.search.index.IndexDocument;
+import org.apache.lucene.gdata.utils.ReferenceCounter;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.QueryFilter;
+import org.apache.lucene.search.TermQuery;
+
+/**
+ * Standard implementation of
+ * {@link org.apache.lucene.gdata.search.GDataSearcher}
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class StandardGdataSearcher implements GDataSearcher<String> {
+ private final AtomicBoolean isClosed = new AtomicBoolean(false);
+
+ private final ReferenceCounter<IndexSearcher> searcher;
+
+ private static final Map<String, QueryFilter> queryFilterCache = new WeakHashMap<String, QueryFilter>();
+
+ /** constructs a new GdataSearcher
+ * @param searcher - the current lucene searcher instance
+ */
+ public StandardGdataSearcher(ReferenceCounter<IndexSearcher> searcher) {
+ if (searcher == null)
+ throw new IllegalArgumentException("searcher must not be null");
+
+ this.searcher = searcher;
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.GDataSearcher#search(org.apache.lucene.search.Query,
+ * int, int, java.lang.String)
+ */
+ public List<String> search(Query query, int hitcount, int offset,
+ String feedId) throws IOException {
+ if (hitcount < 0 || offset < 0)
+ throw new IllegalArgumentException(
+ "hit count and offset must not be less than 0");
+ if (this.isClosed.get())
+ throw new IllegalStateException("Searcher is closed");
+ if (query == null)
+ throw new RuntimeException("query is null can not apply search");
+ if (feedId == null)
+ throw new IllegalArgumentException("feed id must not be null");
+ QueryFilter filter = null;
+ synchronized (queryFilterCache) {
+ filter = queryFilterCache.get(feedId);
+ }
+ if (filter == null)
+ filter = new QueryFilter(new TermQuery(new Term(
+ IndexDocument.FIELD_FEED_ID, feedId)));
+ IndexSearcher indexSearcher = this.searcher.get();
+ Hits hits = indexSearcher.search(query, filter);
+ synchronized (queryFilterCache) {
+ queryFilterCache.put(feedId, filter);
+ }
+ return collectHits(hits, hitcount, offset);
+
+ }
+
+ protected List<String> collectHits(Hits hits, int hitcount, int offset)
+ throws IOException {
+ int hitLength = hits.length();
+ if (hitLength < offset || hitLength == 0)
+ return new ArrayList<String>(0);
+ if (offset > 0)
+ --offset;
+ /*
+ * include the offset
+ */
+ int remainingHits = hitLength - offset;
+ int returnSize = remainingHits > hitcount ? hitcount : remainingHits;
+ List<String> retVal = new ArrayList<String>(returnSize);
+ for (int i = 0; i < returnSize; i++) {
+ Document doc = hits.doc(offset++);
+ /*
+ * the entry id is sufficient to retrieve the entry from the
+ * storage. the result will be ordered by score (default)
+ */
+ Field field = doc.getField(IndexDocument.FIELD_ENTRY_ID);
+ retVal.add(i, field.stringValue());
+ }
+ return retVal;
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.GDataSearcher#close()
+ */
+ public void close() {
+ this.isClosed.set(true);
+ this.searcher.decrementRef();
+
+ }
+
+ static void flushFilterCache() {
+ queryFilterCache.clear();
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/StandardGdataSearcher.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,178 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType;
+import org.apache.lucene.gdata.search.index.GdataIndexerException;
+import org.apache.lucene.gdata.utils.ReflectionUtils;
+import org.w3c.dom.Node;
+
+/**
+ * Creating Indexable document requires processing of incoming entities as
+ * GData Entries. Entries in the GData protocol might have very different
+ * structures and content. They all have on thing in common as they are atom xml
+ * format. To retrieve the configured elements of the atom format and process the
+ * actual content might differ from element to element.
+ * <p>
+ * Each predefined ContentStrategy can be used to retrieve certain content from
+ * the defined element. Which element to process is defined using a XPath
+ * expression in the gdata-config.xml file.
+ * </p>
+ * <p>
+ * <tt>ContentStrategy</tt> implementation should not be accessed directly. To
+ * get a <tt>ContentStrategy</tt> for a specific
+ * {@link org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType}
+ * use the {@link ContentStrategy#getFieldStrategy} factory method. This method
+ * expects a IndexSchemaField instance with a set <tt>ContentType</tt>. The
+ * return value is a new <tt>ContentStrategy</tt> instance for the defined
+ * <tt>ContentType</tt>.
+ * </p>
+ *
+ * @see org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType
+ * @see org.apache.lucene.gdata.search.index.IndexDocumentBuilder
+ *
+ * @author Simon Willnauer
+ */
+public abstract class ContentStrategy {
+ protected final Store store;
+
+ protected final Index index;
+
+ protected final IndexSchemaField config;
+
+ protected String content;
+
+ protected String fieldName;
+
+ protected ContentStrategy(IndexSchemaField fieldConfiguration) {
+ this(null, null, fieldConfiguration);
+ }
+
+ protected ContentStrategy(Index index, Store store,
+ IndexSchemaField fieldConfig) {
+ if(fieldConfig == null)
+ throw new IllegalArgumentException("IndexSchemaField must not be null");
+ this.config = fieldConfig;
+ this.fieldName = fieldConfig.getName();
+ if (index != null) {
+ this.index = index;
+ } else {
+ this.index = fieldConfig.getIndex() == null ? IndexSchemaField.DEFAULT_INDEX_STRATEGY
+ : fieldConfig.getIndex();
+ }
+ if (store != null) {
+ this.store = store;
+ } else {
+ this.store = fieldConfig.getStore() == null ? IndexSchemaField.DEFAULT_STORE_STRATEGY
+ : fieldConfig.getStore();
+ }
+
+ }
+
+ /**
+ * @param indexable
+ * @throws NotIndexableException
+ */
+ public abstract void processIndexable(
+ Indexable<? extends Node, ? extends ServerBaseEntry> indexable)
+ throws NotIndexableException;
+
+ /**
+ * This method creates a lucene field from the retrieved content of the
+ * entity. Values for Field.Index, Field.Store, the field name and the boost
+ * factor are configured in the <tt>IndexSchemaField</tt> passed by the
+ * constructor e.g the factory method. This method might be overwritten by
+ * subclasses.
+ *
+ * @return the Lucene {@link Field}
+ */
+ public Field[] createLuceneField() {
+ /*
+ * should I test the content for being empty?!
+ * does that make any difference if empty fields are indexed?!
+ */
+ if(this.fieldName==null|| this.content == null)
+ throw new GdataIndexerException("Required field not set fieldName: "+this.fieldName+" content: "+this.content);
+ if(this.content.length()==0){
+ return new Field[0];
+ }
+ Field retValue = new Field(this.fieldName, this.content, this.store,
+ this.index);
+ float boost = this.config.getBoost();
+ if (boost != 1.0f)
+ retValue.setBoost(boost);
+ return new Field[]{retValue};
+
+ }
+
+ /**
+ * This factory method creates the <tt>ContentStrategy</tt> corresponding
+ * to the set <tt>ContentType</tt> value in the <tt>IndexSchemaField</tt>
+ * passed to the method as the single parameter.
+ * <p>
+ * The ContentType must not be null
+ * </p>
+ *
+ * @param fieldConfig -
+ * the field config to use to identify the corresponding
+ * <tt>ContentStrategy</tt>
+ * @return - a new <tt>ContentStrategy</tt> instance
+ */
+ public static ContentStrategy getFieldStrategy(IndexSchemaField fieldConfig) {
+ if (fieldConfig == null)
+ throw new IllegalArgumentException(
+ "field configuration must not be null");
+ ContentType type = fieldConfig.getContentType();
+ if (type == null)
+ throw new IllegalArgumentException(
+ "ContentType in IndexSchemaField must not be null");
+ fieldConfig.getAnalyzerClass();
+
+ switch (type) {
+ case CATEGORY:
+ return new GdataCategoryStrategy(fieldConfig);
+ case HTML:
+ return new HTMLStrategy(fieldConfig);
+ case XHTML:
+ return new XHtmlStrategy(fieldConfig);
+ case GDATADATE:
+ return new GdataDateStrategy(fieldConfig);
+ case TEXT:
+ return new PlainTextStrategy(fieldConfig);
+ case KEYWORD:
+ return new KeywordStrategy(fieldConfig);
+ case CUSTOM:
+ /*
+ * check if this class can be created with default constructor is checked
+ * in IndexSchemaField#setFieldClass and throws RuntimeEx if not. So
+ * server can not start up.
+ */
+ return ReflectionUtils.getDefaultInstance(fieldConfig
+ .getFieldClass());
+ case MIXED:
+ return new MixedContentStrategy(fieldConfig);
+ default:
+ throw new RuntimeException("No content strategy found for " + type);
+ }
+
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/ContentStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,109 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import com.google.gdata.data.ExtensionProfile;
+import com.google.gdata.util.common.xml.XmlWriter;
+
+/**
+ * <tt>Indexable</tt> implementation using the W3C Dom API and JAXP XPath
+ * engine
+ *
+ * @author Simon Willnauer
+ * @param <R> -
+ * a subtype of {@link org.w3c.dom.Node} returned by the applyPath
+ * method
+ * @param <I> -
+ * a subtype of {@link org.apache.lucene.gdata.data.ServerBaseEntry}
+ */
+public class DomIndexable<R extends Node, I extends ServerBaseEntry> extends
+ Indexable<R, I> {
+ private final Document document;
+
+ private final XPath xPath;
+
+ /**
+ * @param applyAble
+ * @throws NotIndexableException
+ */
+ public DomIndexable(I applyAble) throws NotIndexableException {
+ super(applyAble);
+ if (this.applyAble.getServiceConfig() == null)
+ throw new NotIndexableException("ServiceConfig is not set");
+ try {
+ this.document = buildDomDocument();
+ } catch (ParserConfigurationException e) {
+ throw new NotIndexableException("Can not create document builder",
+ e);
+
+ } catch (IOException e) {
+ throw new NotIndexableException(
+ "IO Exception occurred while building indexable", e);
+
+ } catch (SAXException e) {
+ throw new NotIndexableException("Can not parse entry", e);
+
+ }
+ this.xPath = XPathFactory.newInstance().newXPath();
+
+ }
+
+ private Document buildDomDocument() throws ParserConfigurationException,
+ IOException, SAXException {
+ StringWriter stringWriter = new StringWriter();
+ ExtensionProfile profile = this.applyAble.getServiceConfig()
+ .getExtensionProfile();
+ if (profile == null)
+ throw new IllegalStateException("ExtensionProfile is not set");
+ XmlWriter writer = new XmlWriter(stringWriter);
+ this.applyAble.generateAtom(writer, profile);
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance()
+ .newDocumentBuilder();
+ return builder.parse(new InputSource(new StringReader(stringWriter
+ .toString())));
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.Indexable#applyPath(java.lang.String)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public R applyPath(String expression) throws XPathExpressionException {
+
+ return (R) this.xPath.evaluate(expression, this.document,
+ XPathConstants.NODE);
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/DomIndexable.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,163 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.document.Field;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.index.GdataIndexerException;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * This strategy retrieves the category term and and the scheme from a category
+ * element. The content is represented by the term which can be configured via
+ * the configuration file.
+ * <p>
+ * The category element has at least one attribute with the name "scheme" which
+ * is not mandatory. The term can be the default attribute "term" or the text
+ * content of the element, this is configured via the path of the field.
+ * </p>
+ * <p>
+ * <tt><category scheme="http://www.example.com/type" term="blog.post"/><tt>
+ * </p>
+ * TODO extend javadoc for search info
+ * @author Simon Willnauer
+ *
+ */
+public class GdataCategoryStrategy extends ContentStrategy {
+ protected String categoryScheme;
+
+ protected String categorySchemeField;
+
+ private static final String LABEL = "label";
+
+ private static final String SCHEME = "scheme";
+
+ private static final String TERM = "term";
+
+ /**
+ * the string to search a schema if no schema is specified
+ */
+ public static final String CATEGORY_SCHEMA_NULL_VALUE = "LUCISCHEMANULL";
+
+ /**
+ * Schema field suffix
+ */
+ public static final String CATEGORY_SCHEMA_FIELD_SUFFIX = "-schema";
+
+ protected GdataCategoryStrategy(IndexSchemaField fieldConfiguration) {
+ super(fieldConfiguration);
+ this.categorySchemeField = new StringBuilder(this.fieldName).append(
+ CATEGORY_SCHEMA_FIELD_SUFFIX).toString();
+
+ }
+
+ /**
+ * @throws NotIndexableException
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#processIndexable(org.apache.lucene.gdata.search.analysis.Indexable)
+ */
+ @Override
+ public void processIndexable(
+ Indexable<? extends Node, ? extends ServerBaseEntry> indexable)
+ throws NotIndexableException {
+ String contentPath = this.config.getPath();
+ Node node = null;
+ try {
+ node = indexable.applyPath(contentPath);
+ } catch (XPathExpressionException e) {
+
+ throw new NotIndexableException("Can not apply path");
+ }
+ if (node == null)
+ throw new NotIndexableException(
+ "Could not retrieve content for schema field: "
+ + this.config);
+
+ StringBuilder contentBuilder = new StringBuilder();
+ StringBuilder schemeBuilder = new StringBuilder();
+ /*
+ * enable more than one category element
+ */
+ while (node != null) {
+ NamedNodeMap attributeMap = node.getAttributes();
+ if (attributeMap == null)
+ throw new NotIndexableException(
+ "category term attribute not present");
+ /*
+ * the "term" is the internal string used by the software to
+ * identify the category, while the "label" is the human-readable
+ * string presented to a user in a user interface.
+ */
+ Node termNode = attributeMap.getNamedItem(TERM);
+ if (termNode == null)
+ throw new NotIndexableException(
+ "category term attribute not present");
+ contentBuilder.append(termNode.getTextContent()).append(" ");
+
+ Node labelNode = attributeMap.getNamedItem(LABEL);
+ if (labelNode != null)
+ contentBuilder.append(labelNode.getTextContent()).append(" ");
+
+ Node schemeNode = attributeMap.getNamedItem(SCHEME);
+ if (schemeNode != null)
+ schemeBuilder.append(schemeNode.getTextContent());
+ node = node.getNextSibling();
+ }
+
+ this.content = contentBuilder.toString();
+ this.categoryScheme = schemeBuilder.toString();
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#createLuceneField()
+ */
+ @Override
+ public Field[] createLuceneField() {
+ List<Field> retValue = new ArrayList<Field>(2);
+ if (this.fieldName == null)
+ throw new GdataIndexerException("Required field 'name' is null -- "
+ + this.config);
+ if (this.content == null)
+ throw new GdataIndexerException(
+ "Required field 'content' is null -- " + this.config);
+
+ Field categoryTerm = new Field(this.fieldName, this.content,
+ this.store, this.index);
+ float boost = this.config.getBoost();
+ if (boost != 1.0f)
+ categoryTerm.setBoost(boost);
+ retValue.add(categoryTerm);
+ /*
+ * if schema is not set index null value to enable search for categories
+ * without a schema
+ */
+ if (this.categoryScheme == null || this.categoryScheme.length() == 0) {
+ this.categoryScheme = CATEGORY_SCHEMA_NULL_VALUE;
+ }
+ Field categoryURN = new Field(this.categorySchemeField,
+ this.categoryScheme, Field.Store.YES, Field.Index.UN_TOKENIZED);
+ retValue.add(categoryURN);
+ return retValue.toArray(new Field[0]);
+
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataCategoryStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,98 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.document.Field;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.index.GdataIndexerException;
+import org.w3c.dom.Node;
+
+import com.google.gdata.data.DateTime;
+
+/**
+ * This content strategy retrieves a so called GData Date from a RFC 3339
+ * timestamp format. The format will be parsed and indexed as a timestamp value.
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class GdataDateStrategy extends ContentStrategy {
+
+ protected GdataDateStrategy(IndexSchemaField fieldConfiguration) {
+ super(fieldConfiguration);
+
+ }
+
+ /**
+ * @throws NotIndexableException
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#processIndexable(org.apache.lucene.gdata.search.analysis.Indexable)
+ */
+ @Override
+ public void processIndexable(
+ Indexable<? extends Node, ? extends ServerBaseEntry> indexable)
+ throws NotIndexableException {
+ String path = this.config.getPath();
+ Node node;
+ try {
+ node = indexable.applyPath(path);
+ } catch (XPathExpressionException e1) {
+ throw new NotIndexableException("Can not apply path -- " + path
+ + " FieldConfig: " + this.config);
+ }
+ if (node == null)
+ throw new NotIndexableException(
+ "Could not retrieve content for schema field: "
+ + this.config);
+ String textContent = node.getTextContent();
+ try {
+ this.content = getTimeStamp(textContent);
+ } catch (NumberFormatException e) {
+ throw new NotIndexableException("Can not parse GData date -- "
+ + textContent);
+ }
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#createLuceneField()
+ */
+ @Override
+ public Field[] createLuceneField() {
+ if(this.fieldName == null)
+ throw new GdataIndexerException(
+ "Required field 'name' is null -- " +this.config);
+ if(this.content == null)
+ throw new GdataIndexerException(
+ "Required field 'content' is null -- " +this.config);
+ if(this.content.length()==0)
+ return new Field[0];
+ Field retValue = new Field(this.fieldName, this.content,
+ Field.Store.YES, Field.Index.UN_TOKENIZED);
+ float boost = this.config.getBoost();
+ if (boost != 1.0f)
+ retValue.setBoost(boost);
+ return new Field[] { retValue };
+
+ }
+
+ private static String getTimeStamp(String dateString) {
+ return Long.toString(DateTime.parseDateTimeChoice(dateString).getValue());
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/GdataDateStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,98 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.xerces.xni.XNIException;
+import org.apache.xerces.xni.parser.XMLDocumentFilter;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.apache.xerces.xni.parser.XMLParserConfiguration;
+import org.cyberneko.html.HTMLConfiguration;
+import org.cyberneko.html.filters.ElementRemover;
+import org.cyberneko.html.filters.Writer;
+import org.w3c.dom.Node;
+
+/**
+ * This ContentStrategy applies the path to the Indexable and retrieves the
+ * plain string content from the returning node. All of the nodes text content
+ * will cleaned from any html tags.
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class HTMLStrategy extends
+ org.apache.lucene.gdata.search.analysis.ContentStrategy {
+ private static final String REMOVE_SCRIPT = "script";
+
+ private static final String CHAR_ENCODING = "UTF-8";
+
+ protected HTMLStrategy(IndexSchemaField fieldConfiguration) {
+ super(fieldConfiguration);
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#processIndexable(org.apache.lucene.gdata.search.analysis.Indexable)
+ */
+ @Override
+ public void processIndexable(Indexable<? extends Node, ? extends ServerBaseEntry> indexable)
+ throws NotIndexableException {
+ String path = this.config.getPath();
+ Node node = null;
+ try {
+ node = indexable.applyPath(path);
+ } catch (XPathExpressionException e1) {
+ throw new NotIndexableException("Can not apply path -- " + path);
+
+ }
+ if(node == null)
+ throw new NotIndexableException("Could not retrieve content for schema field: "+this.config);
+ StringReader contentReader = new StringReader(node.getTextContent());
+ /*
+ * remove all elements and script parts
+ */
+ ElementRemover remover = new ElementRemover();
+ remover.removeElement(REMOVE_SCRIPT);
+ StringWriter contentWriter = new StringWriter();
+ Writer writer = new Writer(contentWriter, CHAR_ENCODING);
+ XMLDocumentFilter[] filters = { remover, writer, };
+ XMLParserConfiguration parser = new HTMLConfiguration();
+ parser.setProperty("http://cyberneko.org/html/properties/filters",
+ filters);
+ XMLInputSource source = new XMLInputSource(null, null, null,
+ contentReader, CHAR_ENCODING);
+ try {
+ parser.parse(source);
+ } catch (XNIException e) {
+ throw new NotIndexableException("Can not parse html -- ", e);
+
+ } catch (IOException e) {
+ throw new NotIndexableException("Can not parse html -- ", e);
+
+ }
+ this.content = contentWriter.toString();
+ }
+
+
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/HTMLStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,74 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.w3c.dom.Node;
+
+/**
+ * This class wraps the access to the GData entities to access them via xpath
+ * expressions. An arbitrary valid Xpath expression can be passed to the
+ * <tt>applyPath</tt> method to access an element, attribute etc. in the gdata
+ * entity.
+ *
+ * @author Simon Willnauer
+ * @param <R> -
+ * a subtype of {@link org.w3c.dom.Node} returned by the applyPath
+ * method
+ * @param <I> -
+ * a subtype of {@link org.apache.lucene.gdata.data.ServerBaseEntry}
+ */
+public abstract class Indexable<R extends Node, I extends ServerBaseEntry> {
+ protected ServerBaseEntry applyAble;
+
+ /**
+ * @param applyAble
+ */
+ Indexable(I applyAble) {
+ this.applyAble = applyAble;
+ }
+
+ /**
+ * @param xPath -
+ * a valid xpath expression
+ * @return - the requested element <b>R</b>
+ * @throws XPathExpressionException
+ */
+ public abstract R applyPath(String xPath) throws XPathExpressionException;
+
+ /**
+ * Factory method to create new <tt>Indexable</tt> instances.
+ *
+ * @param <R> -
+ * a subtype of {@link org.w3c.dom.Node} returned by the
+ * applyPath method
+ * @param <I> -
+ * a subtype of
+ * {@link org.apache.lucene.gdata.data.ServerBaseEntry}
+ * @param entry -
+ * the entry to wrap in a <tt>Indexable</tt>
+ * @return - a new instance of <tt>Indexable</tt> to access the entry via
+ * Xpath
+ * @throws NotIndexableException - if <b>I<b> can not be parsed.
+ */
+ public static <R extends Node, I extends ServerBaseEntry> Indexable<R, I> getIndexable(
+ I entry) throws NotIndexableException {
+ return new DomIndexable<R, I>(entry);
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/Indexable.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.document.Field;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.w3c.dom.Node;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+public class KeywordStrategy extends ContentStrategy {
+
+ /**
+ * @param fieldConfig
+ */
+ public KeywordStrategy(IndexSchemaField fieldConfig) {
+ super(Field.Index.UN_TOKENIZED,Field.Store.YES,fieldConfig);
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#processIndexable(org.apache.lucene.gdata.search.analysis.Indexable)
+ */
+ @Override
+ public void processIndexable(Indexable<? extends Node, ? extends ServerBaseEntry> indexable) throws NotIndexableException {
+ String path = this.config.getPath();
+ try {
+ Node node = indexable.applyPath(path);
+ if(node == null)
+ throw new NotIndexableException("Could not retrieve content for schema field: "+this.config);
+ this.content = node.getTextContent();
+ } catch (XPathExpressionException e) {
+ throw new NotIndexableException("Can not apply Path", e);
+ }
+
+ }
+
+
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/KeywordStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,96 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.search.analysis;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.document.Field;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.apache.lucene.gdata.search.config.IndexSchemaField.ContentType;
+import org.w3c.dom.Node;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+public class MixedContentStrategy extends ContentStrategy {
+ protected ContentStrategy strategy;
+
+ protected MixedContentStrategy(IndexSchemaField fieldConfiguration) {
+ super(fieldConfiguration);
+
+ }
+
+ /**
+ * @throws NotIndexableException
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#processIndexable(org.apache.lucene.gdata.search.analysis.Indexable)
+ */
+ @Override
+ public void processIndexable(
+ Indexable<? extends Node, ? extends ServerBaseEntry> indexable)
+ throws NotIndexableException {
+ String path = this.config.getTypePath();
+
+ try {
+ Node node = indexable.applyPath(path);
+ if (node == null)
+ this.strategy = new PlainTextStrategy(this.config);
+ else {
+ String contentType = node.getTextContent();
+
+ this.strategy = chooseStrategy(contentType, this.config);
+ }
+ this.strategy.processIndexable(indexable);
+ } catch (XPathExpressionException e) {
+ throw new NotIndexableException("Can not apply path -- " + path);
+
+ }
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#createLuceneField()
+ */
+ @Override
+ public Field[] createLuceneField() {
+
+ return this.strategy.createLuceneField();
+ }
+
+ private static ContentStrategy chooseStrategy(final String contentType,
+ final IndexSchemaField config) {
+ ContentType type = null;
+ try {
+ type = ContentType.valueOf(contentType==null?"TEXT":contentType.toUpperCase());
+ } catch (Throwable e) {
+ type = ContentType.TEXT;
+ }
+
+ switch (type) {
+ case HTML:
+ return new HTMLStrategy(config);
+
+ case XHTML:
+ return new XHtmlStrategy(config);
+
+ default:
+ return new PlainTextStrategy(config);
+
+ }
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/MixedContentStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.search.analysis;
+
+/**
+ * This exception will be thrown by ContentStrategy instances if an exception
+ * occurs while retrieving content from entries
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class NotIndexableException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1538388864181786380L;
+
+ /**
+ * Constructs a new NotIndexableException
+ */
+ public NotIndexableException() {
+ super();
+
+ }
+
+ /**
+ * Constructs a new NotIndexableException with the specified detail message.
+ *
+ * @param arg0 -
+ * detail message
+ */
+ public NotIndexableException(String arg0) {
+ super(arg0);
+
+ }
+
+ /**
+ * Constructs a new NotIndexableException with the specified detail message
+ * and nested exception.
+ *
+ * @param arg0 -
+ * detail message
+ * @param arg1 -
+ * nested exception
+ */
+ public NotIndexableException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ }
+
+ /**
+ * Constructs a new NotIndexableException with a nested exception caused
+ * this exception.
+ *
+ * @param arg0 -
+ * nested exception
+ */
+ public NotIndexableException(Throwable arg0) {
+ super(arg0);
+
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/NotIndexableException.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.search.analysis;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+import org.w3c.dom.Node;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+public class PlainTextStrategy extends ContentStrategy {
+
+ protected PlainTextStrategy(IndexSchemaField fieldConfiguration) {
+ super(fieldConfiguration);
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.search.analysis.ContentStrategy#processIndexable(org.apache.lucene.gdata.search.analysis.Indexable)
+ */
+ @Override
+ public void processIndexable(Indexable<? extends Node, ? extends ServerBaseEntry> indexable)
+ throws NotIndexableException {
+ String path = this.config.getPath();
+ try {
+ Node node = indexable.applyPath(path);
+ if(node == null)
+ throw new NotIndexableException("Could not retrieve content for schema field: "+this.config);
+ this.content = node.getTextContent();
+
+ } catch (XPathExpressionException e) {
+ throw new NotIndexableException("Can not apply Path", e);
+ }
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/PlainTextStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java Thu Aug 10 15:32:40 2006
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.gdata.search.analysis;
+
+import org.apache.lucene.gdata.search.config.IndexSchemaField;
+
+
+/**
+ * @author Simon Willnauer
+ * @see org.apache.lucene.gdata.search.analysis.TestHTMLStrategy
+ */
+public class XHtmlStrategy extends HTMLStrategy {
+
+
+
+ /**
+ * @param fieldConfig
+ */
+ public XHtmlStrategy(IndexSchemaField fieldConfig) {
+ super(fieldConfig);
+ }
+
+}
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/XHtmlStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html?rev=430568&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html Thu Aug 10 15:32:40 2006
@@ -0,0 +1,10 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Simon Willnauer">
+</head>
+<body>
+Classes used for extracting content from entries and building lucene documents.
+</body>
+</html>
\ No newline at end of file
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/search/analysis/package.html
------------------------------------------------------------------------------
svn:executable = *