# HG changeset patch # User dwinter # Date 1288783589 -3600 # Node ID 5c9c31510f0c9ead3b6e128cc159ebf91e806509 # Parent 72a015318a6dcbd3841a2ddd6db6141e7f982a5f CLOSED - # 16: Zeige nur eine konfigurierbare Anzahl von Treffern an. https://it-dev.mpiwg-berlin.mpg.de/tracs/pythonOcropusTools/ticket/16 diff -r 72a015318a6d -r 5c9c31510f0c .classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.classpath Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff -r 72a015318a6d -r 5c9c31510f0c .project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.project Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,36 @@ + + + fulltextSearch + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + edu.mit.csail.relo.jdt.builder.ReloJDTBuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jdt.core.javanature + edu.mit.csail.relo.jdt.builder.ReloJDTBuilderProjectNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + + diff -r 72a015318a6d -r 5c9c31510f0c .settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.jdt.core.prefs Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,12 @@ +#Wed Aug 11 10:00:53 CEST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff -r 72a015318a6d -r 5c9c31510f0c .settings/org.eclipse.wst.common.component --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.wst.common.component Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,6 @@ + + + + + + diff -r 72a015318a6d -r 5c9c31510f0c .settings/org.eclipse.wst.common.project.facet.core.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,7 @@ + + + + + + + diff -r 72a015318a6d -r 5c9c31510f0c lib/jaxen-1.1.1.jar Binary file lib/jaxen-1.1.1.jar has changed diff -r 72a015318a6d -r 5c9c31510f0c lib/jdom-1.0.jar Binary file lib/jdom-1.0.jar has changed diff -r 72a015318a6d -r 5c9c31510f0c lib/log4j-1.2.15.jar Binary file lib/log4j-1.2.15.jar has changed diff -r 72a015318a6d -r 5c9c31510f0c lib/log4j-LICENSE.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/log4j-LICENSE.txt Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 1999-2005 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. diff -r 72a015318a6d -r 5c9c31510f0c lib/log4j-NOTICE.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/log4j-NOTICE.txt Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,5 @@ +Apache log4j +Copyright 2007 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file diff -r 72a015318a6d -r 5c9c31510f0c lib/org.apache.commons.io_1.4/META-INF/MANIFEST.MF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/org.apache.commons.io_1.4/META-INF/MANIFEST.MF Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Apache Commons IO +Bundle-SymbolicName: org.apache.commons.io +Bundle-Version: 1.4 +Bundle-ClassPath: org.apache.commons.io.jar +Bundle-Vendor: Apache Software Foundation +Export-Package: org.apache.commons.io;uses:="org.apache.commons.io.filefilter", + org.apache.commons.io.comparator, + org.apache.commons.io.filefilter;uses:="org.apache.commons.io", + org.apache.commons.io.input, + org.apache.commons.io.output +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff -r 72a015318a6d -r 5c9c31510f0c lib/org.apache.commons.io_1.4/library.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/org.apache.commons.io_1.4/library.xml Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,18 @@ + + + + commons-io + commons-io + + + 1.4 + + + + + http://commons.apache.org/io/ + + + http://commons.apache.org/downloads/download_io.cgi + + diff -r 72a015318a6d -r 5c9c31510f0c lib/org.apache.commons.io_1.4/license.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/org.apache.commons.io_1.4/license.txt Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff -r 72a015318a6d -r 5c9c31510f0c lib/org.apache.commons.io_1.4/org.apache.commons.io.jar Binary file lib/org.apache.commons.io_1.4/org.apache.commons.io.jar has changed diff -r 72a015318a6d -r 5c9c31510f0c lib/org.apache.commons.io_1.4/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/org.apache.commons.io_1.4/readme.txt Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,13 @@ +----------------- +Apache Commons IO +----------------- + +"Commons IO is a library of utilities to assist with developing IO +functionality. There are three main areas included: + + * Utility classes - with static methods to perform common tasks + * Filters - various implementations of file filters + * Streams - useful stream, reader and writer implementations" + +For more information: +http://commons.apache.org/io/ \ No newline at end of file diff -r 72a015318a6d -r 5c9c31510f0c src/META-INF/MANIFEST.MF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/META-INF/MANIFEST.MF Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/search/FulltextSearch.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/search/FulltextSearch.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,160 @@ +package de.mpiwg.dwinter.fulltext.search; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; + +import javax.swing.text.Document; +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.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.apache.lucene.analysis.de.GermanAnalyzer; +import org.apache.lucene.analysis.fr.FrenchAnalyzer; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.index.CorruptIndexException; +import org.apache.lucene.index.Term; +import org.apache.lucene.queryParser.ParseException; +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopDocsCollector; +import org.apache.lucene.search.TopScoreDocCollector; +import org.apache.lucene.search.WildcardQuery; +import org.apache.lucene.store.LockObtainFailedException; +import org.apache.lucene.util.Version; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import de.mpiwg.dwinter.fulltext.searcher.LanguageSearcher; +import de.mpiwg.dwinter.fulltext.searcher.LanguageSearchers; + + + +public class FulltextSearch { + + protected File index_dir; + + public LanguageSearchers languageSearchers = new LanguageSearchers(); + protected static ArrayList supportedLanguages = new ArrayList(); + + public FulltextSearch(){} + + public FulltextSearch(File index_dir) throws CorruptIndexException, LockObtainFailedException, IOException { + + + this.index_dir=index_dir; + + init_language_searchers(index_dir); + init_languages(); + } + + protected void init_languages() throws CorruptIndexException, LockObtainFailedException, IOException{ + + + + supportedLanguages.add("de"); + supportedLanguages.add("en"); + supportedLanguages.add("fr"); + supportedLanguages.add("la"); + + } + + protected void init_language_searchers(File dir) throws CorruptIndexException, + LockObtainFailedException, IOException { + languageSearchers.add(new LanguageSearcher("de",new GermanAnalyzer(Version.LUCENE_30),dir)); + languageSearchers.add(new LanguageSearcher("en",new StandardAnalyzer(Version.LUCENE_30),dir)); + languageSearchers.add(new LanguageSearcher("fr",new FrenchAnalyzer(Version.LUCENE_30),dir)); + languageSearchers.add(new LanguageSearcher("all",new StandardAnalyzer(Version.LUCENE_30),dir)); + languageSearchers.add(new LanguageSearcher("morph",new StandardAnalyzer(Version.LUCENE_30),dir)); + languageSearchers.add(new LanguageSearcher("la",new StandardAnalyzer(Version.LUCENE_30),dir)); + } + + public Collector search(Query query,String language) throws IOException{ + return languageSearchers.searchLanguage(query, language); + } + + public HashMap search(Query query) throws IOException{ + return languageSearchers.searchAllLanguages(query); + } + + public HashMap searchMD(String searchString, String mdString, ArrayList languages) throws ParseException, IOException { + if (mdString==null & languages==null) + return languageSearchers.parseAndsearchAllLanguages(searchString); + + return languageSearchers.parseAndsearchAllLanguages(searchString,mdString,languages); + + } + + public HashMap search(String searchString) throws IOException, ParseException { + + return languageSearchers.parseAndsearchAllLanguages(searchString); + } + +// TODO: implement donatus +// public HashMap> searchAndAnalyse(String searchString) throws IOException, ParseException { +// +// return languageSearchers.parseAndsearchAndAnalyseAllLanguages(searchString); +// } + + public ArrayList searchForMorph(String path, String word) throws ParseException, IOException, ParserConfigurationException, SAXException, XPathExpressionException { + + LanguageSearcher searcher = languageSearchers.getSearcherByLanguage("morph"); + Term term=new Term("path",path); + Query query=new WildcardQuery(term); + + TopScoreDocCollector col = TopScoreDocCollector.create(10, false); + + searcher.searcher.search(query, col); + + ArrayList ret = new ArrayList(); + + + String morph = null; + //System.out.println("path:"+path); + ScoreDoc[] docs = col.topDocs().scoreDocs; + + + for (ScoreDoc doc:docs){ + morph = searcher.searcher.doc(doc.doc).get("donatusMorph"); + //System.out.println("morph:"+morph); + } + + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(false); // never forget this! + DocumentBuilder builder = factory.newDocumentBuilder(); + InputSource s =new InputSource(new StringReader(morph)); + //System.out.println("morph:"+morph); + //System.out.println("morphende"); + org.w3c.dom.Document doc = builder.parse(s); + + XPathFactory xpathfactory = XPathFactory.newInstance(); + XPath xpath = xpathfactory.newXPath(); + String xquery = "//lemma[@form='"+word+"']/variant/@form"; + XPathExpression expr = xpath.compile(xquery); + //System.out.println("xpath now:"+xquery); + Object result = expr.evaluate(doc, XPathConstants.NODESET); + NodeList nodes = (NodeList) result; + for (int i = 0; i < nodes.getLength(); i++) { + //System.out.println("nodeS:"+nodes.item(i).getNodeValue()); + ret.add(nodes.item(i).getNodeValue()); + } + + return ret; + } + + + +} diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/search/FulltextSearchConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/search/FulltextSearchConfig.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,27 @@ +package de.mpiwg.dwinter.fulltext.search; + +import java.io.File; +import java.util.ArrayList; + +public class FulltextSearchConfig { + + File docIndex; + File lineIndex; + public FulltextSearchConfig(File docIndex,File lineIndex){ + this.docIndex = docIndex; + this.lineIndex = lineIndex; + } + public ArrayList getSupportedLanguages() { + // TODO Auto-generated method stub + + String[] dirs = docIndex.list(); + ArrayList filteredList = new ArrayList(); + for (String dir:dirs){ + if(!dir.equals("all") && !dir.equals("morph")){ + filteredList.add(dir); + } + + } + return filteredList; + } +} diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/search/cli/Search.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/search/cli/Search.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,113 @@ +package de.mpiwg.dwinter.fulltext.search.cli; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Date; +import java.util.HashMap; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPathExpressionException; + +import org.apache.lucene.document.Document; +import org.apache.lucene.queryParser.ParseException; +import org.apache.lucene.queryParser.QueryParser; +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopDocsCollector; +import org.xml.sax.SAXException; + +import de.mpiwg.dwinter.fulltext.search.FulltextSearch; +import de.mpiwg.dwinter.fulltext.searcher.LanguageSearcher; + +public class Search { + + /** + * @param args + * @throws IOException + * @throws ParseException + * @throws SAXException + * @throws ParserConfigurationException + * @throws XPathExpressionException + */ + public static void main(String[] args) throws IOException, ParseException, XPathExpressionException, ParserConfigurationException, SAXException { + + String usage = "search "; + if (args.length != 1) { + System.err.println("Usage: " + usage); + System.exit(1); + } + + String queries = null; + FulltextSearch fulltextSearcher = new FulltextSearch(new File(args[0])); + + BufferedReader in = null; + if (queries != null) { + in = new BufferedReader(new FileReader(queries)); + } else { + in = new BufferedReader(new InputStreamReader(System.in)); + } + + while (true) { + if (queries == null) // prompt the user + System.out.println("Enter query: "); + + String line = in.readLine(); + + if (line == null || line.length() == -1) + break; + + line = line.trim(); + if (line.length() == 0) + break; + + System.out.println("line: "+line); + + HashMap resultHash = fulltextSearcher.languageSearchers.parseAndsearchAllLanguages(line); + + for (String lang: resultHash.keySet()) + { + LanguageSearcher searcher = fulltextSearcher.languageSearchers.getSearcherByLanguage(lang); + TopDocsCollector col = (TopDocsCollector)resultHash.get(lang); + + System.out.println(lang+":"+col.getTotalHits() + " total matching documents"); + + TopDocs td= col.topDocs(); + ScoreDoc[] docs = td.scoreDocs; + final int HITS_PER_PAGE = 10; + for (int start = 0; start < col.getTotalHits(); start += HITS_PER_PAGE) { + int end = Math.min(col.getTotalHits(), start + HITS_PER_PAGE); + + System.out.println("Start:"+String.valueOf(start)); + for(int i = start;i<(start+ HITS_PER_PAGE);i++){ + //for (ScoreDoc scoreDoc:Adocs) { + ScoreDoc scoreDoc = docs[i]; + Document doc = searcher.searcher.doc(scoreDoc.doc); + + String path = doc.get("path"); + String textId = doc.get("textId"); + + System.out.println("path:"+path); + System.out.println("docnr:"+String.valueOf(scoreDoc.doc)); + System.out.println("textId:"+textId); + } + if (queries != null) // non-interactive + break; + + if (col.getTotalHits() > end) { + System.out.println("more (y/n) ? "); + line = in.readLine(); + if (line.length() == 0 || line.charAt(0) == 'n') + break; + } + } + } + } + fulltextSearcher.languageSearchers.close(); + } +} + diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/search/utils/OCRDoc.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/search/utils/OCRDoc.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,17 @@ +package de.mpiwg.dwinter.fulltext.search.utils; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Map; + +import org.apache.lucene.document.Document; + +public class OCRDoc { + + public long docId; + public Document document; + public Map> linesInPage; // pagenummer -> lines + public String textId; + + +} diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/search/utils/OCRLine.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/search/utils/OCRLine.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,21 @@ +package de.mpiwg.dwinter.fulltext.search.utils; + +public class OCRLine { + + public String lineNumber; + public String bbox; + public String content; + public String pageDimension; + + public OCRLine(String lineNumber,String bbox,String content,String pageDimension){ + this.lineNumber=lineNumber; + this.bbox=bbox; + this.content=content; + this.pageDimension=pageDimension; + } + + public String toString(){ + return lineNumber+"|"+bbox + "|"+pageDimension; + } + public OCRLine(){} +} diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/searcher/LanguageSearcher.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/searcher/LanguageSearcher.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,127 @@ +package de.mpiwg.dwinter.fulltext.searcher; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.HashMap; + + + +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.index.CorruptIndexException; +import org.apache.lucene.queryParser.ParseException; +import org.apache.lucene.queryParser.QueryParser; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Searcher; +import org.apache.lucene.search.TopScoreDocCollector; +import org.apache.lucene.store.LockObtainFailedException; +import org.apache.lucene.util.Version; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import com.sun.org.apache.xerces.internal.parsers.SAXParser; + +import de.mpiwg.dwinter.lucencetools.analyzer.LanguageAnalyzer; + +public class LanguageSearcher extends LanguageAnalyzer { + + static final int MAX_RESULTS = 10000; // Maximalanzahl Treffer + public Searcher searcher=null; + public QueryParser parser=null; + public LanguageSearcher(String lang, Analyzer analyzer, File index_dir) + throws CorruptIndexException, LockObtainFailedException, + IOException { + super(lang, analyzer, index_dir,true); + searcher = new IndexSearcher(this.reader); + parser = new QueryParser(Version.LUCENE_30,"contents",analyzer); + + } + + public Collector parseAndSearch(String searchString) throws ParseException, IOException + { + Query query= parser.parse(searchString); + System.out.println("Parse and search:"+query); + System.out.println("Parse and search lang:"+this.lang); + + TopScoreDocCollector col = TopScoreDocCollector.create(MAX_RESULTS, false); + + //searcher.searcher.search(query, col); + + searcher.search(query,col); + return col; + + } + + public Collector parseAndSearch(String searchString, String mdString) throws ParseException, IOException { + Query query= parser.parse(searchString +" AND dcMetaData:"+mdString); + System.out.println("Parse and search:"+query); + System.out.println("Parse and search lang:"+this.lang); + TopScoreDocCollector col = TopScoreDocCollector.create(MAX_RESULTS, false); + //searcher.searcher.search(query, col); + searcher.search(query,col); + return col; + } + +// TODO: implement the donatus bits +// public HashMap parseAndSearchAndAnalyse(String searchString) throws ParseException, IOException +// { +// HashMap retMap = new HashMap(); +// Query query= parser.parse(searchString); +// System.out.println("Parse and search and analyse:"+query); +// +// TopScoreDocCollector col = TopScoreDocCollector.create(MAX_RESULTS, false); +// //searcher.searcher.search(query, col); +// searcher.search(query,col); +// +// String word; +// +// try { +// +// word = getNormalizedSearchString(((DonatusAnalyzer)analyzer).morphFile.toString()); +// +// } catch (RuntimeException e) { +// +// word=searchString; +// } +// +// retMap.put(word, result); +// return retMap; +// +// } + +// private String getNormalizedSearchString(String string) throws IOException { +// +// +// XMLReader XMLparser = new SAXParser(); +// ParseDonatusResultDocument ch = new ParseDonatusResultDocument(); +// XMLparser.setContentHandler(ch); +// +// try { +// System.out.println("CCCCCCCCCCC:"+string); +// Reader reader = new StringReader(string); +// InputSource input = new InputSource(reader); +// XMLparser.parse(input); +// +// } catch (SAXException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// +// String ret = ""; +// +// for (String lemma: ch.value.values()) +// { +// ret+=lemma+" "; +// } +// +// return ret; +// } + + +} diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/searcher/LanguageSearchers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/searcher/LanguageSearchers.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,137 @@ +package de.mpiwg.dwinter.fulltext.searcher; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.lucene.queryParser.ParseException; + +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.TopScoreDocCollector; + + + +public class LanguageSearchers extends ArrayList { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public LanguageSearcher getSearcherByLanguage(String lang) + { + LanguageSearcher search= null; + for (LanguageSearcher searcher: this) + { + if (searcher.lang.equals(lang)) + { + search = searcher; + } + + } + return search; + } + + public Collector searchLanguage(Query query, String language) throws IOException { + + + LanguageSearcher search = getSearcherByLanguage(language); + if (search==null) + return null; + + TopScoreDocCollector col = TopScoreDocCollector.create(LanguageSearcher.MAX_RESULTS, false); + + //searcher.searcher.search(query, col); + + search.searcher.search(query,col); + return col; + + } + + public HashMap searchAllLanguages(Query query) throws IOException { + + HashMap ret = new HashMap(); + + for (LanguageSearcher searcher : this) + { + //System.out.println("search:"+searcher.lang); + TopScoreDocCollector col = TopScoreDocCollector.create(LanguageSearcher.MAX_RESULTS, false); + searcher.searcher.search(query,col); + ret.put(searcher.lang,col); + } + return ret; + + } + + public HashMap parseAndsearchAllLanguages(String searchString) throws IOException, ParseException { + + HashMap ret = new HashMap(); + + for (LanguageSearcher searcher : this) + { + //System.out.println("XXXX:"+searcher.lang); + //System.out.println("parseAndsearchAllLanguages:"+searchString); + //System.out.println("parseAndsearchAllLanguages (lang):"+searcher.lang); + + try { + ret.put(searcher.lang,searcher.parseAndSearch(searchString)); + } catch (RuntimeException e) { + System.err.println("Language "+searcher.lang+" not supported for search!"); + } + + } + System.out.println("parseAndSearchAllLanguages: done"); + return ret; + + } + + public HashMap parseAndsearchAllLanguages(String searchString, String mdString, ArrayList languages) throws ParseException, IOException { + HashMap ret = new HashMap(); + + for (LanguageSearcher searcher : this) + { + //System.out.println("XXXX:"+searcher.lang); + //System.out.println("parseAndsearchAllLanguages:"+searchString); + //System.out.println("parseAndsearchAllLanguages (lang):"+searcher.lang); + if (languages!=null) + if (!languages.contains(searcher.lang)){ + continue; + } + try { + if (mdString==null) + ret.put(searcher.lang,searcher.parseAndSearch(searchString)); + else + ret.put(searcher.lang,searcher.parseAndSearch(searchString,mdString)); + } catch (RuntimeException e) { + e.printStackTrace(); + System.err.println("Language "+searcher.lang+" not supported for search!"); + } + + } + System.out.println("parseAndSearchAllLanguages: done"); + + return ret; + + } + public void close() throws IOException + { + for (LanguageSearcher searcher : this) + searcher.searcher.close(); + } + +// TODO:implement donatus tools +// public HashMap> parseAndsearchAndAnalyseAllLanguages( +// String searchString) throws ParseException, IOException { +// //HashMap ret = new HashMap(); +// +// HashMap> ret = new HashMap>(); +// for (LanguageSearcher searcher : this) +// ret.put(searcher.lang,searcher.parseAndSearchAndAnalyse(searchString)); +// +// +// return ret; +// } + + +} diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/tests/TestSearchInLines.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/tests/TestSearchInLines.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,85 @@ +package de.mpiwg.dwinter.fulltext.tests; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Date; +import java.util.HashMap; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPathExpressionException; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.Term; +import org.apache.lucene.queryParser.ParseException; +import org.apache.lucene.queryParser.QueryParser; +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopDocsCollector; +import org.apache.lucene.util.Version; +import org.xml.sax.SAXException; + +import de.mpiwg.dwinter.fulltext.search.FulltextSearch; +import de.mpiwg.dwinter.fulltext.search.FulltextSearchDocsLines; +import de.mpiwg.dwinter.fulltext.searcher.LanguageSearcher; + +public class TestSearchInLines { + + protected static Logger logger = Logger.getRootLogger(); + + public static void main(String[] args) throws IOException, ParseException, XPathExpressionException, ParserConfigurationException, SAXException { + + + BasicConfigurator.configure(); + logger.setLevel(Level.ALL); + + String usage = "search "; + if (args.length != 3) { + System.err.println("Usage: " + usage); + System.exit(1); + } + + String queries = null; + FulltextSearchDocsLines fulltextSearcher = new FulltextSearchDocsLines(new File(args[0]),new File(args[1])); + + BufferedReader in = null; + if (queries != null) { + in = new BufferedReader(new FileReader(queries)); + } else { + in = new BufferedReader(new InputStreamReader(System.in)); + } + + while (true) { + if (queries == null) // prompt the user + System.out.println("Enter query: "); + + String line = in.readLine(); + + if (line == null || line.length() == -1) + break; + + line = line.trim(); + if (line.length() == 0) + break; + + System.out.println("line: "+line); + + //Query query= new TermQuery(new Term("contents",line)); + Analyzer analyzer = fulltextSearcher.languageSearchers.getSearcherByLanguage(args[2]).analyzer; + QueryParser parser = new QueryParser(Version.LUCENE_30,"contents",analyzer); + Query query= parser.parse(line); + System.out.println(fulltextSearcher.searchInLines(query,args[2])); + + } + } +} + diff -r 72a015318a6d -r 5c9c31510f0c src/de/mpiwg/dwinter/fulltext/tests/TestSearchInLinesToDir.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/de/mpiwg/dwinter/fulltext/tests/TestSearchInLinesToDir.java Wed Nov 03 12:26:29 2010 +0100 @@ -0,0 +1,85 @@ +package de.mpiwg.dwinter.fulltext.tests; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Date; +import java.util.HashMap; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPathExpressionException; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.Term; +import org.apache.lucene.queryParser.ParseException; +import org.apache.lucene.queryParser.QueryParser; +import org.apache.lucene.search.Collector; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TopDocsCollector; +import org.apache.lucene.util.Version; +import org.xml.sax.SAXException; + +import de.mpiwg.dwinter.fulltext.search.FulltextSearch; +import de.mpiwg.dwinter.fulltext.search.FulltextSearchDocsLines; +import de.mpiwg.dwinter.fulltext.searcher.LanguageSearcher; + +public class TestSearchInLinesToDir { + + protected static Logger logger = Logger.getRootLogger(); + + public static void main(String[] args) throws IOException, ParseException, XPathExpressionException, ParserConfigurationException, SAXException { + + + BasicConfigurator.configure(); + logger.setLevel(Level.ALL); + + String usage = "search "; + if (args.length != 3) { + System.err.println("Usage: " + usage); + System.exit(1); + } + + String queries = null; + FulltextSearchDocsLines fulltextSearcher = new FulltextSearchDocsLines(new File(args[0]),new File(args[1])); + + BufferedReader in = null; + if (queries != null) { + in = new BufferedReader(new FileReader(queries)); + } else { + in = new BufferedReader(new InputStreamReader(System.in)); + } + + while (true) { + if (queries == null) // prompt the user + System.out.println("Enter query: "); + + String line = in.readLine(); + + if (line == null || line.length() == -1) + break; + + line = line.trim(); + if (line.length() == 0) + break; + + System.out.println("line: "+line); + + //Query query= new TermQuery(new Term("contents",line)); + Analyzer analyzer = fulltextSearcher.languageSearchers.getSearcherByLanguage(args[2]).analyzer; + QueryParser parser = new QueryParser(Version.LUCENE_30,"contents",analyzer); + Query query= parser.parse(line); + fulltextSearcher.searchInLinesToDir(query,args[2],"1"); + + } + } +} +