r63941 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63940‎ | r63941 | r63942 >
Date:02:44, 19 March 2010
Author:mah
Status:deferred
Tags:
Comment:
* Add tests for fullwidth/halfwidth normalisation
* Make configure work with relative paths
* Make build.xml work better (more cleaning, add version number to dist files.)
* Update release notes
* TODO: make junit stuff work on more setups.
Modified paths:
  • /trunk/lucene-search-2/README.txt (modified) (history)
  • /trunk/lucene-search-2/RELEASE-NOTES.txt (modified) (history)
  • /trunk/lucene-search-2/build.properties (modified) (history)
  • /trunk/lucene-search-2/build.xml (modified) (history)
  • /trunk/lucene-search-2/configure (modified) (history)
  • /trunk/lucene-search-2/src/org/wikimedia/lsearch/util/PHPParser.java (modified) (history)
  • /trunk/lucene-search-2/test/org/wikimedia/lsearch/analyzers/ArticlesParser.java (modified) (history)
  • /trunk/lucene-search-2/test/org/wikimedia/lsearch/analyzers/FastWikiTokenizerTest.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-2/test/org/wikimedia/lsearch/analyzers/ArticlesParser.java
@@ -16,21 +16,20 @@
1717 *
1818 */
1919 public class ArticlesParser {
20 -
 20+
2121 protected ArrayList<TestArticle> articles;
22 -
23 -
 22+
2423 /**
25 - * Initialize from a file path, open file and read into memory
26 - *
 24+ * Initialize from a file path, open file and read into memory
 25+ *
2726 * @param filename
2827 */
2928 public ArticlesParser(String filename){
3029 BufferedReader in;
3130 try {
3231 articles = new ArrayList<TestArticle>();
33 - in = new BufferedReader(new FileReader(filename));
34 - readFromFile(in);
 32+ in = new BufferedReader(new FileReader(filename));
 33+ readFromFile(in);
3534 in.close();
3635 } catch (FileNotFoundException e) {
3736 // TODO Auto-generated catch block
@@ -40,10 +39,10 @@
4140 e.printStackTrace();
4241 }
4342 }
44 -
 43+
4544 /**
4645 * Read some articles from BufferedReader
47 - *
 46+ *
4847 * @param in
4948 */
5049 protected void readFromFile(BufferedReader in){
@@ -52,7 +51,7 @@
5352 boolean readingContent = false;
5453 try {
5554 while ((str = in.readLine()) != null){
56 - if(readingContent){
 55+ if(readingContent){
5756 if(str.startsWith("###")){
5857 // done
5958 articles.add(a);
@@ -84,12 +83,12 @@
8584 e.printStackTrace();
8685 }
8786 }
88 -
 87+
8988 /**
9089 * @return Returns the articles.
9190 */
9291 public ArrayList<TestArticle> getArticles() {
9392 return articles;
94 - }
95 -
 93+ }
 94+
9695 }
Index: trunk/lucene-search-2/test/org/wikimedia/lsearch/analyzers/FastWikiTokenizerTest.java
@@ -94,7 +94,13 @@
9595 assertEquals("1 [test] 1 [apostrophe's] 0 [apostrophes] 1 [and] 1 [other’s] 0 [others]",
9696 tokens("Test apostrophe's and other\u2019s."));
9797
 98+ assertEquals("1 [abcdef] 0 [abcdef]",
 99+ tokens("ABCDEF"));
98100
 101+ assertEquals("1 [123456789] 0 [123456789]",
 102+ tokens("123456789"));
 103+
 104+
99105 }
100106
101107 public void testHighlight(){
Index: trunk/lucene-search-2/configure
@@ -1,2 +1,4 @@
22 #!/bin/bash
3 -java -cp LuceneSearch.jar org.wikimedia.lsearch.util.Configure $@
 3+dir=`cd $1; pwd`
 4+
 5+java -cp LuceneSearch.jar org.wikimedia.lsearch.util.Configure $dir
Index: trunk/lucene-search-2/RELEASE-NOTES.txt
@@ -1,3 +1,8 @@
 2+Lucene Search 2.1.3
 3+===================
 4+
 5+* Fix normalization of fullwidth numbers.
 6+
27 Lucene Search 2.0.2
38 ====================
49
Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/util/PHPParser.java
@@ -432,7 +432,7 @@
433433 }
434434 try{
435435 PHPParser p = new PHPParser();
436 - String initset = p.readURL(new URL("file:///home/wikipedia/common/php-1.5/InitialiseSettings.php"));
 436+ String initset = p.readURL(new URL("InitialiseSettings.php"));
437437 System.out.println(p.getLanguages(initset));
438438 System.out.println("wgServer: " + p.getServer(initset));
439439 System.out.println(p.getDefaultSearch(initset));
Index: trunk/lucene-search-2/build.properties
@@ -1,4 +1,4 @@
2 -version=2.1
 2+version=2.1.3
33 pack.name=lucene-search
44 pack.src.name=lucene-search-src
55 binary.name=lucene-search-bin
Index: trunk/lucene-search-2/build.xml
@@ -71,52 +71,49 @@
7272
7373 <target name="build" description="Compile classes">
7474 <mkdir dir="${dest.dir}"/>
75 - <javac srcdir="${src.dir}/org/" debug="on" encoding="UTF-8" includes="**/*.java" destdir="${dest.dir}/">
 75+ <javac srcdir="${src.dir}/org/" debug="on" encoding="UTF-8" includes="**/*.java" destdir="${dest.dir}/">
7676 <classpath refid="classpath"/>
7777 </javac>
7878 </target>
7979
80 - <target name="pack" description="Make tar.gz distribution">
 80+ <target name="clean-dist" description="Clean up the dist dir">
8181 <mkdir dir="${dist.dir}"/>
82 - <delete file="${dist.dir}/${pack.name}.tar"/>
83 - <delete file="${dist.dir}/${pack.name}.tar.gz"/>
84 - <tar tarfile="${dist.dir}/${pack.name}.tar">
85 - <tarfileset prefix="${pack.name}" dir="." includes="${include}"/>
 82+ <delete file="${dist.dir}/*.tar"/>
 83+ <delete file="${dist.dir}/*.tar.gz"/>
 84+ </target>
 85+
 86+ <target name="pack" depends="clean-dist" description="Make tar.gz distribution">
 87+ <tar tarfile="${dist.dir}/${pack.name}-${version}.tar">
 88+ <tarfileset prefix="${pack.name}-${version}" dir="." includes="${include}"/>
8689 </tar>
87 -
88 - <gzip zipfile="${dist.dir}/${pack.name}.tar.gz" src="${dist.dir}/${pack.name}.tar"/>
89 - <delete file="${dist.dir}/${pack.name}.tar"/>
 90+ <gzip zipfile="${dist.dir}/${pack.name}-${version}.tar.gz" src="${dist.dir}/${pack.name}-${version}.tar"/>
 91+ <delete file="${dist.dir}/${pack.name}-${version}.tar"/>
9092 </target>
9193
92 - <target name="pack-src" depends="alljar" description="Make tar.gz distribution of only core source files">
93 - <mkdir dir="${dist.dir}"/>
94 - <delete file="${dist.dir}/${src.name}.tar"/>
95 - <delete file="${dist.dir}/${src.name}.tar.gz"/>
96 - <tar tarfile="${dist.dir}/${src.name}.tar">
97 - <tarfileset prefix="${pack.name}" dir="." includes="${include.src}"/>
 94+ <target name="pack-src" depends="alljar, clean-dist" description="Make tar.gz distribution of only core source files">
 95+ <tar tarfile="${dist.dir}/${src.name}-${version}.tar">
 96+ <tarfileset prefix="${pack.name}-${version}" dir="." includes="${include.src}"/>
9897 </tar>
9998
100 - <gzip zipfile="${dist.dir}/${src.name}.tar.gz" src="${dist.dir}/${src.name}.tar"/>
101 - <delete file="${dist.dir}/${src.name}.tar"/>
 99+ <gzip zipfile="${dist.dir}/${src.name}-${version}.tar.gz" src="${dist.dir}/${src.name}-${version}.tar"/>
 100+ <delete file="${dist.dir}/${src.name}-${version}.tar"/>
102101 </target>
103102
104103
105 - <target name="binary" depends="alljar" description="Make binary tar.gz distribution">
106 - <mkdir dir="${dest.dir}"/>
107 - <delete file="${dist.dir}/${binary.name}.tar"/>
108 - <delete file="${dist.dir}/${binary.name}.tar.gz"/>
109 - <tar tarfile="${dist.dir}/${binary.name}.tar">
110 - <tarfileset prefix="${pack.name}" dir="." includes="${jar.name} ${include.bin}"
 104+ <target name="binary" depends="alljar, clean-dist" description="Make binary tar.gz distribution">
 105+ <tar tarfile="${dist.dir}/${binary.name}-${version}.tar">
 106+ <tarfileset prefix="${pack.name}-${version}" dir="." includes="${jar.name} ${include.bin}"
111107 excludes="template/backup/**"/>
112 - <tarfileset prefix="${pack.name}" mode="755" dir="." includes="${include.sh}"/>
 108+ <tarfileset prefix="${pack.name}-${version}" mode="755" dir="." includes="${include.sh}"/>
113109 </tar>
114110
115 - <gzip zipfile="${dist.dir}/${binary.name}.tar.gz" src="${dist.dir}/${binary.name}.tar"/>
116 - <delete file="${dist.dir}/${binary.name}.tar"/>
 111+ <gzip zipfile="${dist.dir}/${binary.name}-${version}.tar.gz" src="${dist.dir}/${binary.name}-${version}.tar"/>
 112+ <delete file="${dist.dir}/${binary.name}-${version}.tar"/>
117113 </target>
118114
119 - <target name="test-build" description="Compile the junit tests">
120 - <javac srcdir="${test.dir}" destdir="${test.dir}">
 115+ <target name="test-build" depends="alljar" description="Compile the junit tests">
 116+ <mkdir dir="${junit.class.dir}"/>
 117+ <javac srcdir="${test.dir}" destdir="${junit.class.dir}">
121118 <classpath>
122119 <pathelement path="${java.class.path}"/>
123120 <pathelement location="${collector.dir}"/>
@@ -127,12 +124,12 @@
128125
129126 <target name="test" depends="test-build">
130127 <property name="collector.dir" value="${test.dir}"/>
131 - <mkdir dir="${junit.class.dir}"/>
132128
133129 <junit haltonerror="false" haltonfailure="false" printsummary="yes"
134130 errorProperty="tests.failed" failureproperty="tests.failed">
135131 <classpath>
136132 <pathelement path="${java.class.path}"/>
 133+ <pathelement location="${junit.class.dir}"/>
137134 <pathelement location="${collector.dir}"/>
138135 <pathelement path="${jar.name}"/>
139136 </classpath>
@@ -142,14 +139,20 @@
143140 <formatter type="plain" usefile="false"/>
144141 </batchtest>
145142 </junit>
 143+ <fail if="tests.failed" message="Test(s) failed."/>
146144 </target>
147 - <fail if="tests.failed" message="Test(s) failed."/>
148145
149146 <target name="clean"
150147 description="Destroys all generated files and dirs.">
151148 <delete dir="${dest.dir}"/>
152149 <delete dir="${dist.dir}"/>
153150 <delete dir="${junit.class.dir}"/>
 151+ <delete dir="dumps"/>
 152+ <delete dir="indexes"/>
154153 <delete file="${basedir}/${jar.name}"/>
 154+ <delete file="lsearch.log4j"/>
 155+ <delete file="lsearch-global.conf"/>
 156+ <delete file="lsearch.conf"/>
 157+ <delete file="config.inc"/>
155158 </target>
156159 </project>
Index: trunk/lucene-search-2/README.txt
@@ -4,14 +4,14 @@
55 == Requirements ==
66
77 - Java 5 +
8 - - MediaWiki 1.13 with MWSearch extension
 8+ - MediaWiki 1.13 with MWSearch extension
99 - Apache Ant 1.6 (for building from source)
1010
1111 == Installation ==
1212
1313 A single-host, single-wiki configuration can be generated as follows.
1414
15 -First make sure LuceneSearch.jar is present. If building from sources,
 15+First make sure LuceneSearch.jar is present. If building from sources,
1616 run ant to make it:
1717
1818 ant
@@ -28,16 +28,16 @@
2929
3030 This will build search, highlight and spellcheck indexes from xml
3131 database dump. For small wikis, just put this script into daily
32 -cron and installation is done.
 32+cron and installation is done.
3333
34 -For larger wikis, install OAIRepository MediaWiki extension and
 34+For larger wikis, install OAIRepository MediaWiki extension and
3535 after building the initial index use incremental updater:
3636
3737 ./update
3838
3939 This will fetch latest updates from your wiki, and update various
40 -indexes with search, page links and spell check data. Put this into
41 -daily cron to keep the indexes up-to-date.
 40+indexes with search, page links and spell check data. Put this into
 41+daily cron to keep the indexes up-to-date.
4242
4343 == Running ==
4444
@@ -45,9 +45,9 @@
4646
4747 ./lsearchd
4848
49 -The deamon will listen on port 8123 for incoming search requests
 49+The deamon will listen on port 8123 for incoming search requests
5050 from MediaWiki, and on port 8321 for incoming incremental updates
51 -for the index.
 51+for the index.
5252
5353 == Further notes ==
5454

Status & tagging log