r10903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10902‎ | r10903 | r10904 >
Date:22:56, 4 September 2005
Author:vibber
Status:old
Tags:
Comment:
Syncing work code: added index optimizer tool, tweaked format bits (?)
Modified paths:
  • /trunk/mwsearch/Benchmark/Benchmark.mdp (modified) (history)
  • /trunk/mwsearch/Daemon/Daemon.mdp (modified) (history)
  • /trunk/mwsearch/Daemon/Worker.cs (modified) (history)
  • /trunk/mwsearch/Makefile (modified) (history)
  • /trunk/mwsearch/Prefix/Prefix.mdp (modified) (history)
  • /trunk/mwsearch/Search.mds (modified) (history)
  • /trunk/mwsearch/Search/Search.mdp (modified) (history)
  • /trunk/mwsearch/Search/SearchWriter.cs (modified) (history)
  • /trunk/mwsearch/SearchTool (added) (history)
  • /trunk/mwsearch/SearchTool/.cvsignore (added) (history)
  • /trunk/mwsearch/SearchTool/AssemblyInfo.cs (added) (history)
  • /trunk/mwsearch/SearchTool/MWSearchTool.mdp (added) (history)
  • /trunk/mwsearch/SearchTool/SearchTool.cs (added) (history)
  • /trunk/mwsearch/Tests/Tests.mdp (modified) (history)
  • /trunk/mwsearch/UpdateDaemon/UpdateDaemon.mdp (modified) (history)
  • /trunk/mwsearch/UpdateDaemon/UpdateRecord.cs (modified) (history)
  • /trunk/mwsearch/UpdateDaemon/UpdateThread.cs (modified) (history)

Diff [purge]

Index: trunk/mwsearch/Tests/Tests.mdp
@@ -1,5 +1,5 @@
22 <Project name="Tests" fileversion="2.0" language="C#" ctype="DotNetProject">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
55 <Output directory="./bin/Debug" assembly="Tests" />
66 <Build debugmode="True" target="Exe" />
@@ -13,11 +13,6 @@
1414 <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
1515 </Configuration>
1616 </Configurations>
17 - <References>
18 - <ProjectReference type="Project" localcopy="True" refto="Search" />
19 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
20 - <ProjectReference type="Project" localcopy="True" refto="Daemon" />
21 - </References>
2217 <DeploymentInformation strategy="File">
2318 <excludeFiles />
2419 </DeploymentInformation>
@@ -25,4 +20,10 @@
2621 <File name="./Main.cs" subtype="Code" buildaction="Compile" />
2722 <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
2823 </Contents>
 24+ <References>
 25+ <ProjectReference type="Project" localcopy="True" refto="Search" />
 26+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
 27+ <ProjectReference type="Project" localcopy="True" refto="Daemon" />
 28+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 29+ </References>
2930 </Project>
\ No newline at end of file
Index: trunk/mwsearch/Daemon/Daemon.mdp
@@ -1,5 +1,5 @@
22 <Project name="Daemon" fileversion="2.0" language="C#" ctype="DotNetProject">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
55 <Output directory="./bin/Debug" assembly="MWDaemon" />
66 <Build debugmode="True" target="Exe" />
@@ -13,14 +13,6 @@
1414 <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
1515 </Configuration>
1616 </Configurations>
17 - <References>
18 - <ProjectReference type="Project" localcopy="True" refto="Search" />
19 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
20 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
21 - <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
22 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Nini.dll" />
23 - <ProjectReference type="Project" localcopy="True" refto="Prefix" />
24 - </References>
2517 <DeploymentInformation strategy="File">
2618 <excludeFiles />
2719 </DeploymentInformation>
@@ -31,4 +23,13 @@
3224 <File name="./QueryStringMap.cs" subtype="Code" buildaction="Compile" />
3325 <File name="./NamespaceFilter.cs" subtype="Code" buildaction="Compile" />
3426 </Contents>
 27+ <References>
 28+ <ProjectReference type="Project" localcopy="True" refto="Search" />
 29+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
 30+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
 31+ <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 32+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Nini.dll" />
 33+ <ProjectReference type="Project" localcopy="True" refto="Prefix" />
 34+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 35+ </References>
3536 </Project>
\ No newline at end of file
Index: trunk/mwsearch/Daemon/Worker.cs
@@ -49,8 +49,6 @@
5050 */
5151 public class Worker {
5252 private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
53 - private static readonly Encoding utf8 = new UTF8Encoding();
54 -
5553
5654 /** The search term after urlencoding */
5755 string searchterm;
@@ -154,7 +152,9 @@
155153 dbname = paths[2];
156154 searchterm = HttpUtility.UrlDecode(paths[3], Encoding.UTF8);
157155
158 - log.Info("query:" + bits[1] + " what:"+what+" dbname:"+dbname+" term:"+searchterm);
 156+ log.InfoFormat("query:{0} what:{1} dbname:{2} term:{3}",
 157+ bits[1], what, dbname, searchterm);
 158+
159159 IDictionary query = new QueryStringMap(uri);
160160
161161 state = SearchPool.ForWiki(dbname);
@@ -183,7 +183,7 @@
184184 }
185185
186186 private void SendHeaders(int code, string message) {
187 - SendOutputLine("HTTP/1.1 " + code + " " + message);
 187+ SendOutputLine(String.Format("HTTP/1.1 {0} {1}", code, message));
188188 SendOutputLine("Content-Type: text/plain");
189189 SendOutputLine("Connection: Close");
190190 SendOutputLine("");
@@ -191,7 +191,7 @@
192192 }
193193
194194 private void DoNormalSearch(int offset, int limit, NamespaceFilter namespaces) {
195 - string encsearchterm = "title:(" + searchterm + ")^4 " + searchterm;
 195+ string encsearchterm = String.Format("title:({0})^4 {1}", searchterm, searchterm);
196196
197197 DateTime now = DateTime.UtcNow;
198198 Query query;
@@ -227,11 +227,11 @@
228228 TimeSpan delta = DateTime.UtcNow - now;
229229 LogRequest(searchterm, query, numhits, delta);
230230
231 - SendOutputLine(numhits + "");
 231+ SendOutputLine(numhits.ToString());
232232
233233 if (numhits == 0) {
234234 string spelfix = MakeSpelFix(searchterm);
235 - SendOutputLine(HttpUtility.UrlEncode(spelfix, utf8));
 235+ SendOutputLine(HttpUtility.UrlEncode(spelfix, Encoding.UTF8));
236236 } else {
237237 // Lucene's filters seem to want to run over the entire
238238 // document set, which is really slow. We'll do namespace
@@ -249,7 +249,8 @@
250250 if (matches++ < offset)
251251 continue;
252252 string title = doc.Get("title");
253 - string squish=pageNamespace+":"+title;
 253+ /*
 254+ string squish = pageNamespace+":"+title;
254255 if (lastMatch.Equals(squish)) {
255256 // skip duplicate results due to indexing bugs
256257 maxoffset++;
@@ -257,6 +258,7 @@
258259 continue;
259260 }
260261 lastMatch = squish;
 262+ */
261263 float score = hits.Score(i);
262264 SendResultLine(score, pageNamespace, title);
263265 if (matches >= (limit + offset))
@@ -405,13 +407,13 @@
406408 }
407409
408410 private void SendOutputLine(string sout) {
409 - log.Debug(">>>" + sout);
 411+ log.DebugFormat(">>>{0}", sout);
410412 ostrm.WriteLine(sout);
411413 }
412414
413415 private string ReadInputLine() {
414416 string sin = istrm.ReadLine();
415 - log.Debug("<<<" + sin);
 417+ log.DebugFormat("<<<{0}", sin);
416418 return sin;
417419 }
418420
@@ -428,8 +430,8 @@
429431 * @throws UnsupportedEncodingException
430432 */
431433 private void SendResultLine(float score, string pageNamespace, string title) {
432 - SendOutputLine(score + " " + pageNamespace + " " +
433 - HttpUtility.UrlEncode(title.Replace(" ", "_"), Encoding.UTF8));
 434+ SendOutputLine(String.Format("{0} {1} {2}", score, pageNamespace,
 435+ HttpUtility.UrlEncode(title.Replace(" ", "_"), Encoding.UTF8)));
434436 }
435437
436438 }
Index: trunk/mwsearch/SearchTool/AssemblyInfo.cs
@@ -0,0 +1,32 @@
 2+using System.Reflection;
 3+using System.Runtime.CompilerServices;
 4+
 5+// Information about this assembly is defined by the following
 6+// attributes.
 7+//
 8+// change them to the information which is associated with the assembly
 9+// you compile.
 10+
 11+[assembly: AssemblyTitle("")]
 12+[assembly: AssemblyDescription("")]
 13+[assembly: AssemblyConfiguration("")]
 14+[assembly: AssemblyCompany("")]
 15+[assembly: AssemblyProduct("")]
 16+[assembly: AssemblyCopyright("")]
 17+[assembly: AssemblyTrademark("")]
 18+[assembly: AssemblyCulture("")]
 19+
 20+// The assembly version has following format :
 21+//
 22+// Major.Minor.Build.Revision
 23+//
 24+// You can specify all values by your own or you can build default build and revision
 25+// numbers with the '*' character (the default):
 26+
 27+[assembly: AssemblyVersion("1.0.*")]
 28+
 29+// The following attributes specify the key for the sign of your assembly. See the
 30+// .NET Framework documentation for more information about signing.
 31+// This is not required, if you don't want signing let these attributes like they're.
 32+[assembly: AssemblyDelaySign(false)]
 33+[assembly: AssemblyKeyFile("")]
Property changes on: trunk/mwsearch/SearchTool/AssemblyInfo.cs
___________________________________________________________________
Added: svn:keywords
134 + Author Date Id Revision
Added: svn:eol-style
235 + native
Index: trunk/mwsearch/SearchTool/MWSearchTool.mdp
@@ -0,0 +1,27 @@
 2+<Project name="MWSearchTool" fileversion="2.0" language="C#" ctype="DotNetProject">
 3+ <Configurations active="Debug">
 4+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
 5+ <Output directory="./bin/Debug" assembly="MWSearchTool" />
 6+ <Build debugmode="True" target="Exe" />
 7+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
 8+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
 9+ </Configuration>
 10+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
 11+ <Output directory="./bin/Release" assembly="MWSearchTool" />
 12+ <Build debugmode="False" target="Exe" />
 13+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
 14+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
 15+ </Configuration>
 16+ </Configurations>
 17+ <DeploymentInformation strategy="File">
 18+ <excludeFiles />
 19+ </DeploymentInformation>
 20+ <Contents>
 21+ <File name="./SearchTool.cs" subtype="Code" buildaction="Compile" />
 22+ <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
 23+ </Contents>
 24+ <References>
 25+ <ProjectReference type="Project" localcopy="True" refto="Search" />
 26+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 27+ </References>
 28+</Project>
\ No newline at end of file
Property changes on: trunk/mwsearch/SearchTool/MWSearchTool.mdp
___________________________________________________________________
Added: svn:keywords
129 + Author Date Id Revision
Added: svn:eol-style
230 + native
Index: trunk/mwsearch/SearchTool/SearchTool.cs
@@ -0,0 +1,73 @@
 2+/*
 3+ * Copyright 2005 Brion Vibber
 4+ *
 5+ * Permission is hereby granted, free of charge, to any person obtaining a copy
 6+ * of this software and associated documentation files (the "Software"), to deal
 7+ * in the Software without restriction, including without limitation the rights
 8+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 9+ * copies of the Software, and to permit persons to whom the Software is
 10+ * furnished to do so, subject to the following conditions:
 11+ *
 12+ * The above copyright notice and this permission notice shall be included in
 13+ * all copies or substantial portions of the Software.
 14+ *
 15+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 20+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 21+ * SOFTWARE.
 22+ *
 23+ * $Id$
 24+ */
 25+
 26+namespace MediaWiki.Search.SearchTool {
 27+ using System;
 28+ using System.Collections;
 29+
 30+ using MediaWiki.Search;
 31+
 32+ public class SearchTool {
 33+ private static Configuration config;
 34+
 35+ public static void Main(string[] args) {
 36+ Console.WriteLine("MediaWiki Lucene search indexer - index manipulation tool.\n");
 37+
 38+ string configSection = "Updater";
 39+ ArrayList databases = new ArrayList();
 40+ string action = null;
 41+
 42+ for (int i = 0; i < args.Length; i++) {
 43+ if (args[i] == "--daemon") {
 44+ configSection = "Daemon";
 45+ } else if (args[i] == "--optimize") {
 46+ action = "optimize";
 47+ } else if (!args[i].StartsWith("--")) {
 48+ databases.Add(args[i]);
 49+ }
 50+ }
 51+
 52+ if (action == null) {
 53+ Console.WriteLine("No action specified; try --optimize.");
 54+ System.Environment.Exit(-1);
 55+ }
 56+
 57+ if (databases.Count == 0) {
 58+ Console.WriteLine("Cowardly refusing to operate with no databases given.");
 59+ System.Environment.Exit(-1);
 60+ }
 61+
 62+ Configuration.SetIndexSection(configSection);
 63+ config = Configuration.Open();
 64+
 65+ foreach (string dbname in databases) {
 66+ SearchWriter state = new SearchWriter(dbname);
 67+ Console.WriteLine("Optimizing " + dbname);
 68+ state.Optimize();
 69+ }
 70+
 71+ Console.WriteLine("Done!");
 72+ }
 73+ }
 74+}
Property changes on: trunk/mwsearch/SearchTool/SearchTool.cs
___________________________________________________________________
Added: svn:keywords
175 + Author Date Id Revision
Added: svn:eol-style
276 + native
Index: trunk/mwsearch/SearchTool/.cvsignore
@@ -0,0 +1,3 @@
 2+*~
 3+bin
 4+*.pidb
Property changes on: trunk/mwsearch/SearchTool/.cvsignore
___________________________________________________________________
Added: svn:keywords
15 + Author Date Id Revision
Added: svn:eol-style
26 + native
Property changes on: trunk/mwsearch/SearchTool
___________________________________________________________________
Added: svn:ignore
37 + *~
bin
*.pidb
Index: trunk/mwsearch/Search/Search.mdp
@@ -1,5 +1,5 @@
22 <Project name="Search" fileversion="2.0" language="C#" ctype="DotNetProject">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
55 <Output directory="./bin/Debug" assembly="MWSearch" />
66 <Build debugmode="True" target="Library" />
@@ -13,11 +13,6 @@
1414 <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
1515 </Configuration>
1616 </Configurations>
17 - <References>
18 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
19 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
20 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Nini.dll" />
21 - </References>
2217 <DeploymentInformation strategy="File">
2318 <excludeFiles />
2419 </DeploymentInformation>
@@ -32,4 +27,10 @@
3328 <File name="./SearchWriter.cs" subtype="Code" buildaction="Compile" />
3429 <File name="./SearchPool.cs" subtype="Code" buildaction="Compile" />
3530 </Contents>
 31+ <References>
 32+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
 33+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
 34+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Nini.dll" />
 35+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 36+ </References>
3637 </Project>
\ No newline at end of file
Index: trunk/mwsearch/Search/SearchWriter.cs
@@ -42,12 +42,12 @@
4343 public void Close() {
4444 try {
4545 if (writer != null) {
46 - log.Info("Closing writer for " + mydbname);
 46+ log.InfoFormat("Closing writer for {0}", mydbname);
4747 writer.Close();
4848 writer = null;
4949 }
5050 } catch (IOException e) {
51 - log.Error(mydbname + ": warning: closing index: " + e.Message);
 51+ log.ErrorFormat("{0}: warning: closing index: {1}", mydbname, e.Message);
5252 }
5353 }
5454
@@ -65,7 +65,7 @@
6666 if (writer != null)
6767 return;
6868
69 - log.Info("Opening index writer for " + mydbname);
 69+ log.InfoFormat("Opening index writer for {0}", mydbname);
7070 writer = new IndexWriter(indexpath, analyzer, false);
7171 }
7272
Index: trunk/mwsearch/UpdateDaemon/UpdateDaemon.mdp
@@ -1,5 +1,5 @@
22 <Project name="UpdateDaemon" fileversion="2.0" Description="Search index updater daemon.&#xA;Accepts XML-RPC requests on port 8124&#xA;and merges page updates into a copy of&#xA;the index. Periodically that can be copied&#xA;to the search daemons' local read-only dbs." language="C#" ctype="DotNetProject">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
55 <Output directory="./bin/Debug" assembly="MWUpdateDaemon" />
66 <Build debugmode="True" target="Exe" />
@@ -13,13 +13,6 @@
1414 <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
1515 </Configuration>
1616 </Configurations>
17 - <References>
18 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/CookComputing.XmlRpc.dll" />
19 - <ProjectReference type="Project" localcopy="True" refto="Search" />
20 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
21 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
22 - <ProjectReference type="Assembly" localcopy="True" refto="../libs/Nini.dll" />
23 - </References>
2417 <DeploymentInformation strategy="File">
2518 <excludeFiles />
2619 </DeploymentInformation>
@@ -30,4 +23,12 @@
3124 <File name="./app.config" subtype="Code" buildaction="Compile" />
3225 <File name="./UpdateRecord.cs" subtype="Code" buildaction="Compile" />
3326 </Contents>
 27+ <References>
 28+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/CookComputing.XmlRpc.dll" />
 29+ <ProjectReference type="Project" localcopy="True" refto="Search" />
 30+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
 31+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Lucene.Net.dll" />
 32+ <ProjectReference type="Assembly" localcopy="True" refto="../libs/Nini.dll" />
 33+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 34+ </References>
3435 </Project>
\ No newline at end of file
Index: trunk/mwsearch/UpdateDaemon/UpdateRecord.cs
@@ -84,7 +84,7 @@
8585 }
8686
8787 public override string ToString() {
88 - return "update on " + _database + " to " + _article;
 88+ return String.Format("update on {0} to {1}", _database, _article);
8989 }
9090 }
9191
@@ -99,7 +99,7 @@
100100 }
101101
102102 public override string ToString() {
103 - return "deletion on " + _database + " to " + _article;
 103+ return String.Format("deletion on {0} to {1}", _database, _article);
104104 }
105105 }
106106 }
Index: trunk/mwsearch/UpdateDaemon/UpdateThread.cs
@@ -103,7 +103,7 @@
104104 }
105105 ApplyAll(workUpdates, optimize);
106106 } catch (Exception e) {
107 - log.Error("Unexpected error in update thread: " + e);
 107+ log.ErrorFormat("Unexpected error in update thread: {0}", e);
108108 return;
109109 }
110110 }
@@ -124,27 +124,27 @@
125125
126126 private static void ApplyOn(string databaseName, ICollection queue, bool optimize) {
127127 try {
128 - log.Info("Applying updates to " + databaseName);
 128+ log.InfoFormat("Applying updates to {0}", databaseName);
129129
130130 SearchReader reader = new SearchReader(databaseName, SearchReader.CreateIfNew);
131131 foreach (UpdateRecord record in queue) {
132 - log.Info("Applying read pass: " + record);
 132+ log.InfoFormat("Applying read pass: {0}", record);
133133 record.ApplyReads(reader);
134134 }
135135 reader.Close();
136136
137137 SearchWriter writer = new SearchWriter(databaseName);
138138 foreach (UpdateRecord record in queue) {
139 - log.Info("Applying write pass: " + record);
 139+ log.InfoFormat("Applying write pass: {0}", record);
140140 record.ApplyWrites(writer);
141141 }
142142 if (optimize)
143143 writer.Optimize();
144144 writer.Close();
145145
146 - log.Info("Closed updates on " + databaseName);
 146+ log.InfoFormat("Closed updates on {0}", databaseName);
147147 } catch (Exception e) {
148 - log.Error("Unexpected error in update for " + databaseName + ": " + e);
 148+ log.ErrorFormat("Unexpected error in update for {0}: {1}", databaseName, e);
149149 return;
150150 }
151151 }
@@ -184,7 +184,7 @@
185185 // so we don't end up with duplicates in the index.
186186 ((Hashtable)_queuedUpdates[record.Database])[record.Key] = record;
187187 }
188 - log.Info("Queued item: " + record);
 188+ log.InfoFormat("Queued item: {0}", record);
189189 }
190190
191191 public static void Quit() {
Index: trunk/mwsearch/Search.mds
@@ -1,29 +1,32 @@
22 <Combine name="Search" fileversion="2.0" outputpath="./build/bin">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="CombineConfiguration">
5 - <Entry build="False" name="Search" />
6 - <Entry build="False" name="Daemon" />
7 - <Entry build="True" name="Benchmark" />
8 - <Entry build="True" name="Prefix" />
9 - <Entry build="False" name="Tests" />
10 - <Entry build="True" name="UpdateDaemon" />
 5+ <Entry configuration="Debug" build="False" name="Search" />
 6+ <Entry configuration="Debug" build="False" name="Daemon" />
 7+ <Entry configuration="Debug" build="True" name="Benchmark" />
 8+ <Entry configuration="Debug" build="True" name="Prefix" />
 9+ <Entry configuration="Debug" build="False" name="Tests" />
 10+ <Entry configuration="Debug" build="True" name="UpdateDaemon" />
 11+ <Entry configuration="Debug" build="True" name="MWSearchTool" />
1112 </Configuration>
1213 <Configuration name="Release" ctype="CombineConfiguration">
13 - <Entry build="False" name="Search" />
14 - <Entry build="False" name="Daemon" />
15 - <Entry build="True" name="Benchmark" />
16 - <Entry build="True" name="Prefix" />
17 - <Entry build="False" name="Tests" />
18 - <Entry build="True" name="UpdateDaemon" />
 14+ <Entry configuration="Release" build="False" name="Search" />
 15+ <Entry configuration="Release" build="False" name="Daemon" />
 16+ <Entry configuration="Release" build="True" name="Benchmark" />
 17+ <Entry configuration="Release" build="True" name="Prefix" />
 18+ <Entry configuration="Release" build="False" name="Tests" />
 19+ <Entry configuration="Release" build="True" name="UpdateDaemon" />
 20+ <Entry configuration="Debug" build="True" name="MWSearchTool" />
1921 </Configuration>
2022 </Configurations>
21 - <StartMode startupentry="UpdateDaemon" single="True">
 23+ <StartMode startupentry="Search" single="True">
2224 <Execute type="None" entry="Search" />
2325 <Execute type="Execute" entry="Daemon" />
2426 <Execute type="None" entry="Benchmark" />
2527 <Execute type="None" entry="Prefix" />
2628 <Execute type="None" entry="Tests" />
2729 <Execute type="None" entry="UpdateDaemon" />
 30+ <Execute type="None" entry="MWSearchTool" />
2831 </StartMode>
2932 <Entries>
3033 <Entry filename="./Search/Search.mdp" />
@@ -32,5 +35,6 @@
3336 <Entry filename="./Prefix/Prefix.mdp" />
3437 <Entry filename="./Tests/Tests.mdp" />
3538 <Entry filename="./UpdateDaemon/UpdateDaemon.mdp" />
 39+ <Entry filename="./SearchTool/MWSearchTool.mdp" />
3640 </Entries>
3741 </Combine>
\ No newline at end of file
Index: trunk/mwsearch/Benchmark/Benchmark.mdp
@@ -1,5 +1,5 @@
22 <Project name="Benchmark" fileversion="2.0" language="C#" ctype="DotNetProject">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
55 <Output directory="./bin/Debug" assembly="Benchmark" />
66 <Build debugmode="True" target="Exe" />
@@ -13,9 +13,6 @@
1414 <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
1515 </Configuration>
1616 </Configurations>
17 - <References>
18 - <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
19 - </References>
2017 <DeploymentInformation strategy="File">
2118 <excludeFiles />
2219 </DeploymentInformation>
@@ -24,4 +21,8 @@
2522 <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
2623 <File name="./SampleTerms.cs" subtype="Code" buildaction="Compile" />
2724 </Contents>
 25+ <References>
 26+ <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 27+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 28+ </References>
2829 </Project>
\ No newline at end of file
Index: trunk/mwsearch/Makefile
@@ -17,12 +17,14 @@
1818 build/MWPrefix.dll \
1919 build/MWDaemon.exe \
2020 build/MWBenchmark.exe \
21 - build/MWUpdateDaemon.exe
 21+ build/MWUpdateDaemon.exe \
 22+ build/MWSearchTool.exe
2223
2324 SCRIPTS=\
2425 build/MWDaemon.sh \
2526 build/MWBenchmark.sh \
26 - build/MWUpdateDaemon.sh
 27+ build/MWUpdateDaemon.sh \
 28+ build/MWSearchTool.sh
2729
2830 CONFIG=\
2931 build/MWUpdateDaemon.exe.config
@@ -41,12 +43,14 @@
4244 install -m 0755 build/MWDaemon.sh $(INSTALL_BINDIR)/MWBenchmark
4345 install -m 0755 build/MWDaemon.sh $(INSTALL_BINDIR)/MWDaemon
4446 install -m 0755 build/MWUpdateDaemon.sh $(INSTALL_BINDIR)/MWUpdateDaemon
 47+ install -m 0755 build/MWSearchTool.sh $(INSTALL_BINDIR)/MWSearchTool
4548 echo "Don't forget to set up /etc/mwsearch.conf"
4649
4750 uninstall :
4851 rm -f $(INSTALL_BINDIR)/MWBenchmark
4952 rm -f $(INSTALL_BINDIR)/MWDaemon
5053 rm -f $(INSTALL_BINDIR)/MWUpdateDaemon
 54+ rm -f $(INSTALL_BINDIR)/MWSearchTool
5155 rm -f $(INSTALL_ASSEMBLYDIR)/*.dll
5256 rm -f $(INSTALL_ASSEMBLYDIR)/*.exe
5357 rmdir $(INSTALL_ASSEMBLYDIR) || true
@@ -162,6 +166,29 @@
163167 cp -p UpdateDaemon/app.config build/MWUpdateDaemon.exe.config
164168
165169
 170+# MWSearchTool.exe: command-line tool to optimize indexes and such
 171+SEARCHTOOL_SOURCES=\
 172+ SearchTool/AssemblyInfo.cs \
 173+ SearchTool/SearchTool.cs
 174+
 175+SEARCHTOOL_LIBS=\
 176+ build/MWSearch.dll
 177+
 178+SEARCHTOOL_REFERENCES=\
 179+ -r:build/MWSearch.dll \
 180+ $(SEARCH_REFERENCES)
 181+
 182+build/MWSearchTool.exe : $(SEARCHTOOL_LIBS) $(SEARCHTOOL_SOURCES)
 183+ mcs -target:exe -out:$@ \
 184+ $(CSFLAGS) \
 185+ $(SEARCHTOOL_REFERENCES) \
 186+ $(SEARCHTOOL_SOURCES)
 187+
 188+build/MWSearchTool.sh :
 189+ echo "#!/bin/sh" > $@
 190+ echo "mono $(INSTALL_ASSEMBLYDIR)/MWSearchTool.exe \$$@" >> $@
 191+
 192+
166193 build/ICSharpCode.SharpZipLib.dll: libs/ICSharpCode.SharpZipLib.dll
167194 cp -p libs/ICSharpCode.SharpZipLib.dll build/
168195
Index: trunk/mwsearch/Prefix/Prefix.mdp
@@ -1,5 +1,5 @@
22 <Project name="Prefix" fileversion="2.0" language="C#" ctype="DotNetProject">
3 - <Configurations>
 3+ <Configurations active="Debug">
44 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
55 <Output directory="./bin/Debug" assembly="Prefix" />
66 <Build debugmode="True" target="Library" />
@@ -13,16 +13,17 @@
1414 <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
1515 </Configuration>
1616 </Configurations>
 17+ <DeploymentInformation strategy="File">
 18+ <excludeFiles />
 19+ </DeploymentInformation>
 20+ <Contents>
 21+ <File name="./PrefixMatcher.cs" subtype="Code" buildaction="Compile" />
 22+ </Contents>
1723 <References>
1824 <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
1925 <ProjectReference type="Gac" localcopy="True" refto="Mono.Data.SqliteClient, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
2026 <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" />
2127 <ProjectReference type="Project" localcopy="True" refto="Search" />
 28+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
2229 </References>
23 - <DeploymentInformation strategy="File">
24 - <excludeFiles />
25 - </DeploymentInformation>
26 - <Contents>
27 - <File name="./PrefixMatcher.cs" subtype="Code" buildaction="Compile" />
28 - </Contents>
2930 </Project>
\ No newline at end of file

Status & tagging log