001: /*
002: * LIUS - Lucene Index Update and Search
003: * http://sourceforge.net/projects/lius/
004: *
005: * Copyright (c) 2005, Laval University Library. All rights reserved.
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
020: */
021:
022: package ca.ulaval.bibl.lius.main;
023:
024: /**
025: *
026: * @author Rida Benjelloun (rida.benjelloun@bibl.ulaval.ca)
027: *
028: */
029:
030: import java.util.List;
031:
032: import java.io.IOException;
033:
034: import ca.ulaval.bibl.lius.search.SearchIndex;
035:
036: //import java.util.ArrayList;
037:
038: import ca.ulaval.bibl.lius.util.LiusUtils;
039:
040: import java.io.File;
041:
042: import java.util.StringTokenizer;
043:
044: import org.jdom.Document;
045:
046: //import org.jdom.Document;
047:
048: public class TestUtils {
049:
050: public static void main(String[] args) throws IOException {
051:
052: SearchIndex si = new SearchIndex();
053:
054: String sep = File.separator;
055:
056: StringTokenizer st = new StringTokenizer(System.getProperty(
057:
058: "java.class.path"), File.pathSeparator);
059:
060: File classDir = new File(st.nextToken());
061:
062: String indexDir = classDir.getParent() + sep + "luceneIndex";
063:
064: String indexDir1 = classDir.getParent() + sep + "luceneIndex1";
065:
066: String liusConfig = classDir.getParent() + sep + "Config" + sep
067: +
068:
069: "liusFilesConfig.xml";
070:
071: /*
072: * List res = si.search("la*", indexDir, liusConfig);
073: *
074: * LiusUtils.printResults(res);
075: */
076:
077: /*
078: * List indexs = new ArrayList();
079: *
080: * indexs.add(indexDir);
081: *
082: * indexs.add(indexDir1);
083: *
084: * Document jdomDocument =
085: * si.multiIndexSearchResultsAsJDom("gouv*",indexs,liusConfig);
086: *
087: * LiusUtils.saveInXmlFile(jdomDocument,"c:\\test2.xml");
088: *
089: */
090:
091: Document jdomDocument = si.searchResultAsJdomDoc("la*",
092: indexDir, liusConfig);
093:
094: LiusUtils.saveInXmlFile(jdomDocument, "c:\\test2.xml");
095:
096: /*
097: * List res = si.search("un",indexDir,liusConfig);
098: *
099: * LiusUtils.printResults(res);
100: */
101:
102: /*
103: * List indexs = new ArrayList();
104: *
105: * indexs.add(indexDir);
106: *
107: * indexs.add(indexDir1);
108: *
109: *
110: *
111: * List res = si.multiIndexSearch("xml", indexs, liusConfig);
112: *
113: * LiusUtils.printResults(res);
114: */
115:
116: }
117:
118: }
|