Index: trunk/mwsearch/Tests/Tests.mdp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <Project name="Tests" fileversion="2.0" language="C#" ctype="DotNetProject"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
5 | 5 | <Output directory="./bin/Debug" assembly="Tests" /> |
6 | 6 | <Build debugmode="True" target="Exe" /> |
— | — | @@ -13,11 +13,6 @@ |
14 | 14 | <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
15 | 15 | </Configuration> |
16 | 16 | </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> |
22 | 17 | <DeploymentInformation strategy="File"> |
23 | 18 | <excludeFiles /> |
24 | 19 | </DeploymentInformation> |
— | — | @@ -25,4 +20,10 @@ |
26 | 21 | <File name="./Main.cs" subtype="Code" buildaction="Compile" /> |
27 | 22 | <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> |
28 | 23 | </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> |
29 | 30 | </Project> |
\ No newline at end of file |
Index: trunk/mwsearch/Daemon/Daemon.mdp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <Project name="Daemon" fileversion="2.0" language="C#" ctype="DotNetProject"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
5 | 5 | <Output directory="./bin/Debug" assembly="MWDaemon" /> |
6 | 6 | <Build debugmode="True" target="Exe" /> |
— | — | @@ -13,14 +13,6 @@ |
14 | 14 | <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
15 | 15 | </Configuration> |
16 | 16 | </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> |
25 | 17 | <DeploymentInformation strategy="File"> |
26 | 18 | <excludeFiles /> |
27 | 19 | </DeploymentInformation> |
— | — | @@ -31,4 +23,13 @@ |
32 | 24 | <File name="./QueryStringMap.cs" subtype="Code" buildaction="Compile" /> |
33 | 25 | <File name="./NamespaceFilter.cs" subtype="Code" buildaction="Compile" /> |
34 | 26 | </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> |
35 | 36 | </Project> |
\ No newline at end of file |
Index: trunk/mwsearch/Daemon/Worker.cs |
— | — | @@ -49,8 +49,6 @@ |
50 | 50 | */ |
51 | 51 | public class Worker { |
52 | 52 | private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
53 | | - private static readonly Encoding utf8 = new UTF8Encoding(); |
54 | | - |
55 | 53 | |
56 | 54 | /** The search term after urlencoding */ |
57 | 55 | string searchterm; |
— | — | @@ -154,7 +152,9 @@ |
155 | 153 | dbname = paths[2]; |
156 | 154 | searchterm = HttpUtility.UrlDecode(paths[3], Encoding.UTF8); |
157 | 155 | |
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 | + |
159 | 159 | IDictionary query = new QueryStringMap(uri); |
160 | 160 | |
161 | 161 | state = SearchPool.ForWiki(dbname); |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | } |
185 | 185 | |
186 | 186 | 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)); |
188 | 188 | SendOutputLine("Content-Type: text/plain"); |
189 | 189 | SendOutputLine("Connection: Close"); |
190 | 190 | SendOutputLine(""); |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | } |
193 | 193 | |
194 | 194 | 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); |
196 | 196 | |
197 | 197 | DateTime now = DateTime.UtcNow; |
198 | 198 | Query query; |
— | — | @@ -227,11 +227,11 @@ |
228 | 228 | TimeSpan delta = DateTime.UtcNow - now; |
229 | 229 | LogRequest(searchterm, query, numhits, delta); |
230 | 230 | |
231 | | - SendOutputLine(numhits + ""); |
| 231 | + SendOutputLine(numhits.ToString()); |
232 | 232 | |
233 | 233 | if (numhits == 0) { |
234 | 234 | string spelfix = MakeSpelFix(searchterm); |
235 | | - SendOutputLine(HttpUtility.UrlEncode(spelfix, utf8)); |
| 235 | + SendOutputLine(HttpUtility.UrlEncode(spelfix, Encoding.UTF8)); |
236 | 236 | } else { |
237 | 237 | // Lucene's filters seem to want to run over the entire |
238 | 238 | // document set, which is really slow. We'll do namespace |
— | — | @@ -249,7 +249,8 @@ |
250 | 250 | if (matches++ < offset) |
251 | 251 | continue; |
252 | 252 | string title = doc.Get("title"); |
253 | | - string squish=pageNamespace+":"+title; |
| 253 | + /* |
| 254 | + string squish = pageNamespace+":"+title; |
254 | 255 | if (lastMatch.Equals(squish)) { |
255 | 256 | // skip duplicate results due to indexing bugs |
256 | 257 | maxoffset++; |
— | — | @@ -257,6 +258,7 @@ |
258 | 259 | continue; |
259 | 260 | } |
260 | 261 | lastMatch = squish; |
| 262 | + */ |
261 | 263 | float score = hits.Score(i); |
262 | 264 | SendResultLine(score, pageNamespace, title); |
263 | 265 | if (matches >= (limit + offset)) |
— | — | @@ -405,13 +407,13 @@ |
406 | 408 | } |
407 | 409 | |
408 | 410 | private void SendOutputLine(string sout) { |
409 | | - log.Debug(">>>" + sout); |
| 411 | + log.DebugFormat(">>>{0}", sout); |
410 | 412 | ostrm.WriteLine(sout); |
411 | 413 | } |
412 | 414 | |
413 | 415 | private string ReadInputLine() { |
414 | 416 | string sin = istrm.ReadLine(); |
415 | | - log.Debug("<<<" + sin); |
| 417 | + log.DebugFormat("<<<{0}", sin); |
416 | 418 | return sin; |
417 | 419 | } |
418 | 420 | |
— | — | @@ -428,8 +430,8 @@ |
429 | 431 | * @throws UnsupportedEncodingException |
430 | 432 | */ |
431 | 433 | 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))); |
434 | 436 | } |
435 | 437 | |
436 | 438 | } |
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 |
1 | 34 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 35 | + 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 |
1 | 29 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 30 | + 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 |
1 | 75 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 76 | + 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 |
1 | 5 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 6 | + native |
Property changes on: trunk/mwsearch/SearchTool |
___________________________________________________________________ |
Added: svn:ignore |
3 | 7 | + *~ |
bin |
*.pidb |
Index: trunk/mwsearch/Search/Search.mdp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <Project name="Search" fileversion="2.0" language="C#" ctype="DotNetProject"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
5 | 5 | <Output directory="./bin/Debug" assembly="MWSearch" /> |
6 | 6 | <Build debugmode="True" target="Library" /> |
— | — | @@ -13,11 +13,6 @@ |
14 | 14 | <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
15 | 15 | </Configuration> |
16 | 16 | </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> |
22 | 17 | <DeploymentInformation strategy="File"> |
23 | 18 | <excludeFiles /> |
24 | 19 | </DeploymentInformation> |
— | — | @@ -32,4 +27,10 @@ |
33 | 28 | <File name="./SearchWriter.cs" subtype="Code" buildaction="Compile" /> |
34 | 29 | <File name="./SearchPool.cs" subtype="Code" buildaction="Compile" /> |
35 | 30 | </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> |
36 | 37 | </Project> |
\ No newline at end of file |
Index: trunk/mwsearch/Search/SearchWriter.cs |
— | — | @@ -42,12 +42,12 @@ |
43 | 43 | public void Close() { |
44 | 44 | try { |
45 | 45 | if (writer != null) { |
46 | | - log.Info("Closing writer for " + mydbname); |
| 46 | + log.InfoFormat("Closing writer for {0}", mydbname); |
47 | 47 | writer.Close(); |
48 | 48 | writer = null; |
49 | 49 | } |
50 | 50 | } catch (IOException e) { |
51 | | - log.Error(mydbname + ": warning: closing index: " + e.Message); |
| 51 | + log.ErrorFormat("{0}: warning: closing index: {1}", mydbname, e.Message); |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | if (writer != null) |
67 | 67 | return; |
68 | 68 | |
69 | | - log.Info("Opening index writer for " + mydbname); |
| 69 | + log.InfoFormat("Opening index writer for {0}", mydbname); |
70 | 70 | writer = new IndexWriter(indexpath, analyzer, false); |
71 | 71 | } |
72 | 72 | |
Index: trunk/mwsearch/UpdateDaemon/UpdateDaemon.mdp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <Project name="UpdateDaemon" fileversion="2.0" Description="Search index updater daemon.
Accepts XML-RPC requests on port 8124
and merges page updates into a copy of
the index. Periodically that can be copied
to the search daemons' local read-only dbs." language="C#" ctype="DotNetProject"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
5 | 5 | <Output directory="./bin/Debug" assembly="MWUpdateDaemon" /> |
6 | 6 | <Build debugmode="True" target="Exe" /> |
— | — | @@ -13,13 +13,6 @@ |
14 | 14 | <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
15 | 15 | </Configuration> |
16 | 16 | </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> |
24 | 17 | <DeploymentInformation strategy="File"> |
25 | 18 | <excludeFiles /> |
26 | 19 | </DeploymentInformation> |
— | — | @@ -30,4 +23,12 @@ |
31 | 24 | <File name="./app.config" subtype="Code" buildaction="Compile" /> |
32 | 25 | <File name="./UpdateRecord.cs" subtype="Code" buildaction="Compile" /> |
33 | 26 | </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> |
34 | 35 | </Project> |
\ No newline at end of file |
Index: trunk/mwsearch/UpdateDaemon/UpdateRecord.cs |
— | — | @@ -84,7 +84,7 @@ |
85 | 85 | } |
86 | 86 | |
87 | 87 | public override string ToString() { |
88 | | - return "update on " + _database + " to " + _article; |
| 88 | + return String.Format("update on {0} to {1}", _database, _article); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | } |
101 | 101 | |
102 | 102 | public override string ToString() { |
103 | | - return "deletion on " + _database + " to " + _article; |
| 103 | + return String.Format("deletion on {0} to {1}", _database, _article); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
Index: trunk/mwsearch/UpdateDaemon/UpdateThread.cs |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | } |
105 | 105 | ApplyAll(workUpdates, optimize); |
106 | 106 | } catch (Exception e) { |
107 | | - log.Error("Unexpected error in update thread: " + e); |
| 107 | + log.ErrorFormat("Unexpected error in update thread: {0}", e); |
108 | 108 | return; |
109 | 109 | } |
110 | 110 | } |
— | — | @@ -124,27 +124,27 @@ |
125 | 125 | |
126 | 126 | private static void ApplyOn(string databaseName, ICollection queue, bool optimize) { |
127 | 127 | try { |
128 | | - log.Info("Applying updates to " + databaseName); |
| 128 | + log.InfoFormat("Applying updates to {0}", databaseName); |
129 | 129 | |
130 | 130 | SearchReader reader = new SearchReader(databaseName, SearchReader.CreateIfNew); |
131 | 131 | foreach (UpdateRecord record in queue) { |
132 | | - log.Info("Applying read pass: " + record); |
| 132 | + log.InfoFormat("Applying read pass: {0}", record); |
133 | 133 | record.ApplyReads(reader); |
134 | 134 | } |
135 | 135 | reader.Close(); |
136 | 136 | |
137 | 137 | SearchWriter writer = new SearchWriter(databaseName); |
138 | 138 | foreach (UpdateRecord record in queue) { |
139 | | - log.Info("Applying write pass: " + record); |
| 139 | + log.InfoFormat("Applying write pass: {0}", record); |
140 | 140 | record.ApplyWrites(writer); |
141 | 141 | } |
142 | 142 | if (optimize) |
143 | 143 | writer.Optimize(); |
144 | 144 | writer.Close(); |
145 | 145 | |
146 | | - log.Info("Closed updates on " + databaseName); |
| 146 | + log.InfoFormat("Closed updates on {0}", databaseName); |
147 | 147 | } 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); |
149 | 149 | return; |
150 | 150 | } |
151 | 151 | } |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | // so we don't end up with duplicates in the index. |
186 | 186 | ((Hashtable)_queuedUpdates[record.Database])[record.Key] = record; |
187 | 187 | } |
188 | | - log.Info("Queued item: " + record); |
| 188 | + log.InfoFormat("Queued item: {0}", record); |
189 | 189 | } |
190 | 190 | |
191 | 191 | public static void Quit() { |
Index: trunk/mwsearch/Search.mds |
— | — | @@ -1,29 +1,32 @@ |
2 | 2 | <Combine name="Search" fileversion="2.0" outputpath="./build/bin"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <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" /> |
11 | 12 | </Configuration> |
12 | 13 | <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" /> |
19 | 21 | </Configuration> |
20 | 22 | </Configurations> |
21 | | - <StartMode startupentry="UpdateDaemon" single="True"> |
| 23 | + <StartMode startupentry="Search" single="True"> |
22 | 24 | <Execute type="None" entry="Search" /> |
23 | 25 | <Execute type="Execute" entry="Daemon" /> |
24 | 26 | <Execute type="None" entry="Benchmark" /> |
25 | 27 | <Execute type="None" entry="Prefix" /> |
26 | 28 | <Execute type="None" entry="Tests" /> |
27 | 29 | <Execute type="None" entry="UpdateDaemon" /> |
| 30 | + <Execute type="None" entry="MWSearchTool" /> |
28 | 31 | </StartMode> |
29 | 32 | <Entries> |
30 | 33 | <Entry filename="./Search/Search.mdp" /> |
— | — | @@ -32,5 +35,6 @@ |
33 | 36 | <Entry filename="./Prefix/Prefix.mdp" /> |
34 | 37 | <Entry filename="./Tests/Tests.mdp" /> |
35 | 38 | <Entry filename="./UpdateDaemon/UpdateDaemon.mdp" /> |
| 39 | + <Entry filename="./SearchTool/MWSearchTool.mdp" /> |
36 | 40 | </Entries> |
37 | 41 | </Combine> |
\ No newline at end of file |
Index: trunk/mwsearch/Benchmark/Benchmark.mdp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <Project name="Benchmark" fileversion="2.0" language="C#" ctype="DotNetProject"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
5 | 5 | <Output directory="./bin/Debug" assembly="Benchmark" /> |
6 | 6 | <Build debugmode="True" target="Exe" /> |
— | — | @@ -13,9 +13,6 @@ |
14 | 14 | <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
15 | 15 | </Configuration> |
16 | 16 | </Configurations> |
17 | | - <References> |
18 | | - <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
19 | | - </References> |
20 | 17 | <DeploymentInformation strategy="File"> |
21 | 18 | <excludeFiles /> |
22 | 19 | </DeploymentInformation> |
— | — | @@ -24,4 +21,8 @@ |
25 | 22 | <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> |
26 | 23 | <File name="./SampleTerms.cs" subtype="Code" buildaction="Compile" /> |
27 | 24 | </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> |
28 | 29 | </Project> |
\ No newline at end of file |
Index: trunk/mwsearch/Makefile |
— | — | @@ -17,12 +17,14 @@ |
18 | 18 | build/MWPrefix.dll \ |
19 | 19 | build/MWDaemon.exe \ |
20 | 20 | build/MWBenchmark.exe \ |
21 | | - build/MWUpdateDaemon.exe |
| 21 | + build/MWUpdateDaemon.exe \ |
| 22 | + build/MWSearchTool.exe |
22 | 23 | |
23 | 24 | SCRIPTS=\ |
24 | 25 | build/MWDaemon.sh \ |
25 | 26 | build/MWBenchmark.sh \ |
26 | | - build/MWUpdateDaemon.sh |
| 27 | + build/MWUpdateDaemon.sh \ |
| 28 | + build/MWSearchTool.sh |
27 | 29 | |
28 | 30 | CONFIG=\ |
29 | 31 | build/MWUpdateDaemon.exe.config |
— | — | @@ -41,12 +43,14 @@ |
42 | 44 | install -m 0755 build/MWDaemon.sh $(INSTALL_BINDIR)/MWBenchmark |
43 | 45 | install -m 0755 build/MWDaemon.sh $(INSTALL_BINDIR)/MWDaemon |
44 | 46 | install -m 0755 build/MWUpdateDaemon.sh $(INSTALL_BINDIR)/MWUpdateDaemon |
| 47 | + install -m 0755 build/MWSearchTool.sh $(INSTALL_BINDIR)/MWSearchTool |
45 | 48 | echo "Don't forget to set up /etc/mwsearch.conf" |
46 | 49 | |
47 | 50 | uninstall : |
48 | 51 | rm -f $(INSTALL_BINDIR)/MWBenchmark |
49 | 52 | rm -f $(INSTALL_BINDIR)/MWDaemon |
50 | 53 | rm -f $(INSTALL_BINDIR)/MWUpdateDaemon |
| 54 | + rm -f $(INSTALL_BINDIR)/MWSearchTool |
51 | 55 | rm -f $(INSTALL_ASSEMBLYDIR)/*.dll |
52 | 56 | rm -f $(INSTALL_ASSEMBLYDIR)/*.exe |
53 | 57 | rmdir $(INSTALL_ASSEMBLYDIR) || true |
— | — | @@ -162,6 +166,29 @@ |
163 | 167 | cp -p UpdateDaemon/app.config build/MWUpdateDaemon.exe.config |
164 | 168 | |
165 | 169 | |
| 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 | + |
166 | 193 | build/ICSharpCode.SharpZipLib.dll: libs/ICSharpCode.SharpZipLib.dll |
167 | 194 | cp -p libs/ICSharpCode.SharpZipLib.dll build/ |
168 | 195 | |
Index: trunk/mwsearch/Prefix/Prefix.mdp |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <Project name="Prefix" fileversion="2.0" language="C#" ctype="DotNetProject"> |
3 | | - <Configurations> |
| 3 | + <Configurations active="Debug"> |
4 | 4 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
5 | 5 | <Output directory="./bin/Debug" assembly="Prefix" /> |
6 | 6 | <Build debugmode="True" target="Library" /> |
— | — | @@ -13,16 +13,17 @@ |
14 | 14 | <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
15 | 15 | </Configuration> |
16 | 16 | </Configurations> |
| 17 | + <DeploymentInformation strategy="File"> |
| 18 | + <excludeFiles /> |
| 19 | + </DeploymentInformation> |
| 20 | + <Contents> |
| 21 | + <File name="./PrefixMatcher.cs" subtype="Code" buildaction="Compile" /> |
| 22 | + </Contents> |
17 | 23 | <References> |
18 | 24 | <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
19 | 25 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Data.SqliteClient, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
20 | 26 | <ProjectReference type="Assembly" localcopy="True" refto="../libs/log4net.dll" /> |
21 | 27 | <ProjectReference type="Project" localcopy="True" refto="Search" /> |
| 28 | + <ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
22 | 29 | </References> |
23 | | - <DeploymentInformation strategy="File"> |
24 | | - <excludeFiles /> |
25 | | - </DeploymentInformation> |
26 | | - <Contents> |
27 | | - <File name="./PrefixMatcher.cs" subtype="Code" buildaction="Compile" /> |
28 | | - </Contents> |
29 | 30 | </Project> |
\ No newline at end of file |