You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2003/05/20 09:16:29 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/lucene PopulateSampleIndices.java LuceneSearchService.java TestLuceneSearch.java
taylor 2003/05/20 00:16:29
Modified: src/java/org/apache/jetspeed/services/lucene
LuceneSearchService.java TestLuceneSearch.java
Added: src/java/org/apache/jetspeed/services/lucene
PopulateSampleIndices.java
Log:
First go at Lucene Search Portlet
It ain't exactly working (ahem) - it seems it can only find strings that are equal to "jetspeed" :-/
To test this out, run the "lucene-create-indices" target first, then add the Lucene Search portlet to a page
Revision Changes Path
1.5 +0 -2 jakarta-jetspeed/src/java/org/apache/jetspeed/services/lucene/LuceneSearchService.java
Index: LuceneSearchService.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/lucene/LuceneSearchService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LuceneSearchService.java 19 May 2003 23:17:48 -0000 1.4
+++ LuceneSearchService.java 20 May 2003 07:16:29 -0000 1.5
@@ -115,7 +115,6 @@
*/
public synchronized void init(ServletConfig conf) throws InitializationException
{
- System.out.println("Initializing Lucene Service");
// already initialized
if (getInit())
@@ -187,7 +186,6 @@
titleFieldName = serviceConf.getString(CONFIG_TITLE_FIELDNAME, CONFIG_TITLE_FIELDNAME_DEFAULT);
urlFieldName = serviceConf.getString(CONFIG_URL_FIELDNAME, CONFIG_URL_FIELDNAME_DEFAULT);
indexRoot = serviceConf.getString(CONFIG_DIRECTORY);
-
//
// The following section opens or creates the search index
//
1.5 +2 -5 jakarta-jetspeed/src/java/org/apache/jetspeed/services/lucene/TestLuceneSearch.java
Index: TestLuceneSearch.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/lucene/TestLuceneSearch.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestLuceneSearch.java 19 May 2003 23:17:48 -0000 1.4
+++ TestLuceneSearch.java 20 May 2003 07:16:29 -0000 1.5
@@ -56,15 +56,12 @@
import java.net.URL;
-// Cactus and Junit imports
+// Junit imports
import junit.awtui.TestRunner;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
// Turbine imports
-import org.apache.turbine.util.TurbineConfig;
-import org.apache.turbine.util.StringUtils;
import org.apache.jetspeed.services.resources.JetspeedResources;
import org.apache.jetspeed.test.HeadlessBaseTest;
1.1 jakarta-jetspeed/src/java/org/apache/jetspeed/services/lucene/PopulateSampleIndices.java
Index: PopulateSampleIndices.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jetspeed.services.lucene;
import java.io.FileReader;
import java.io.BufferedReader;
import java.net.URL;
import org.apache.turbine.util.TurbineConfig;
/**
* Populate sample data for Lucene Portlet
*
* @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
* @version $Id: PopulateSampleIndices.java,v 1.1 2003/05/20 07:16:29 taylor Exp $
*/
public class PopulateSampleIndices
{
static public final String SAMPLE_URLS = "./test/lucene-sample-urls.txt";
public static void main(String args[])
{
try
{
TurbineConfig config = null;
config = new TurbineConfig( "./webapp", "/WEB-INF/conf/TurbineResources.properties");
config.init();
FileReader reader = new FileReader(SAMPLE_URLS);
BufferedReader breader = new BufferedReader(reader);
String line = null;
System.out.println("================= Populate Sample Indices =================");
System.out.println("... creates Lucene sample portlet test data from URLs provided in file: " + SAMPLE_URLS);
System.out.println("...");
while (null != (line = breader.readLine()))
{
System.out.println("Creating index for: " + line);
URL url = new URL(line);
LuceneSearch.add(url);
}
System.out.println("===========================================================");
reader.close();
}
catch (Exception e)
{
System.out.println("Exception reading URLS" + e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org