Upgrading to Lucene.Net 2.9.4.1

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-12-02 11:12:24 -08:00
parent 72f196e6e2
commit 5fc8b09ba1
6 changed files with 21223 additions and 20960 deletions

View File

@@ -1,239 +1,271 @@
Apache License
Version 2.0, January 2004 Apache License
http://www.apache.org/licenses/ Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document. "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. "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 "Legal Entity" shall mean the union of the acting entity and all
control with that entity. For the purposes of this definition, other entities that control, are controlled by, or are under common
"control" means (i) the power, direct or indirect, to cause the control with that entity. For the purposes of this definition,
direction or management of such entity, whether by contract or "control" means (i) the power, direct or indirect, to cause the
otherwise, or (ii) ownership of fifty percent (50%) or more of the direction or management of such entity, whether by contract or
outstanding shares, or (iii) beneficial ownership of such entity. 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. "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" form shall mean the preferred form for making modifications,
source, and configuration files. 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 "Object" form shall mean any form resulting from mechanical
not limited to compiled object code, generated documentation, transformation or translation of a Source form, including but
and conversions to other media types. 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 "Work" shall mean the work of authorship, whether in Source or
copyright notice that is included in or attached to the work Object form, made available under the License, as indicated by a
(an example is provided in the Appendix below). 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 "Derivative Works" shall mean any work, whether in Source or Object
editorial revisions, annotations, elaborations, or other modifications form, that is based on (or derived from) the Work and for which the
represent, as a whole, an original work of authorship. For the purposes editorial revisions, annotations, elaborations, or other modifications
of this License, Derivative Works shall not include works that remain represent, as a whole, an original work of authorship. For the purposes
separable from, or merely link (or bind by name) to the interfaces of, of this License, Derivative Works shall not include works that remain
the Work and Derivative Works thereof. 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 "Contribution" shall mean any work of authorship, including
to that Work or Derivative Works thereof, that is intentionally the original version of the Work and any modifications or additions
submitted to Licensor for inclusion in the Work by the copyright owner to that Work or Derivative Works thereof, that is intentionally
or by an individual or Legal Entity authorized to submit on behalf of submitted to Licensor for inclusion in the Work by the copyright owner
the copyright owner. For the purposes of this definition, "submitted" or by an individual or Legal Entity authorized to submit on behalf of
means any form of electronic, verbal, or written communication sent the copyright owner. For the purposes of this definition, "submitted"
to the Licensor or its representatives, including but not limited to means any form of electronic, verbal, or written communication sent
communication on electronic mailing lists, source code control systems, to the Licensor or its representatives, including but not limited to
and issue tracking systems that are managed by, or on behalf of, the communication on electronic mailing lists, source code control systems,
Licensor for the purpose of discussing and improving the Work, but and issue tracking systems that are managed by, or on behalf of, the
excluding communication that is conspicuously marked or otherwise Licensor for the purpose of discussing and improving the Work, but
designated in writing by the copyright owner as "Not a Contribution." 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 "Contributor" shall mean Licensor and any individual or Legal Entity
subsequently incorporated within the Work. 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, 2. Grant of Copyright License. Subject to the terms and conditions of
worldwide, non-exclusive, no-charge, royalty-free, irrevocable this License, each Contributor hereby grants to You a perpetual,
copyright license to reproduce, prepare Derivative Works of, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
publicly display, publicly perform, sublicense, and distribute the copyright license to reproduce, prepare Derivative Works of,
Work and such Derivative Works in Source or Object form. 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, 3. Grant of Patent License. Subject to the terms and conditions of
worldwide, non-exclusive, no-charge, royalty-free, irrevocable this License, each Contributor hereby grants to You a perpetual,
(except as stated in this section) patent license to make, have made, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
use, offer to sell, sell, import, and otherwise transfer the Work, (except as stated in this section) patent license to make, have made,
where such license applies only to those patent claims licensable use, offer to sell, sell, import, and otherwise transfer the Work,
by such Contributor that are necessarily infringed by their where such license applies only to those patent claims licensable
Contribution(s) alone or by combination of their Contribution(s) by such Contributor that are necessarily infringed by their
with the Work to which such Contribution(s) was submitted. If You Contribution(s) alone or by combination of their Contribution(s)
institute patent litigation against any entity (including a with the Work to which such Contribution(s) was submitted. If You
cross-claim or counterclaim in a lawsuit) alleging that the Work institute patent litigation against any entity (including a
or a Contribution incorporated within the Work constitutes direct cross-claim or counterclaim in a lawsuit) alleging that the Work
or contributory patent infringement, then any patent licenses or a Contribution incorporated within the Work constitutes direct
granted to You under this License for that Work shall terminate or contributory patent infringement, then any patent licenses
as of the date such litigation is filed. 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 4. Redistribution. You may reproduce and distribute copies of the
modifications, and in Source or Object form, provided that You Work or Derivative Works thereof in any medium, with or without
meet the following conditions: 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 (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 (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 (c) You must retain, in the Source form of any Derivative Works
attribution notices from the Source form of the Work, that You distribute, all copyright, patent, trademark, and
excluding those notices that do not pertain to any part of attribution notices from the Source form of the Work,
the Derivative Works; and 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 (d) If the Work includes a "NOTICE" text file as part of its
include a readable copy of the attribution notices contained distribution, then any Derivative Works that You distribute must
within such NOTICE file, excluding those notices that do not include a readable copy of the attribution notices contained
pertain to any part of the Derivative Works, in at least one within such NOTICE file, excluding those notices that do not
of the following places: within a NOTICE text file distributed pertain to any part of the Derivative Works, in at least one
as part of the Derivative Works; within the Source form or of the following places: within a NOTICE text file distributed
documentation, if provided along with the Derivative Works; or, as part of the Derivative Works; within the Source form or
within a display generated by the Derivative Works, if and documentation, if provided along with the Derivative Works; or,
wherever such third-party notices normally appear. The contents within a display generated by the Derivative Works, if and
of the NOTICE file are for informational purposes only and wherever such third-party notices normally appear. The contents
do not modify the License. You may add Your own attribution of the NOTICE file are for informational purposes only and
notices within Derivative Works that You distribute, alongside do not modify the License. You may add Your own attribution
or as an addendum to the NOTICE text from the Work, provided notices within Derivative Works that You distribute, alongside
that such additional attribution notices cannot be construed or as an addendum to the NOTICE text from the Work, provided
as modifying the License. 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 You may add Your own copyright statement to Your modifications and
for use, reproduction, or distribution of Your modifications, or may provide additional or different license terms and conditions
for any such Derivative Works as a whole, provided Your use, for use, reproduction, or distribution of Your modifications, or
reproduction, and distribution of the Work otherwise complies with for any such Derivative Works as a whole, provided Your use,
the conditions stated in this License. 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 5. Submission of Contributions. Unless You explicitly state otherwise,
by You to the Licensor shall be under the terms and conditions of any Contribution intentionally submitted for inclusion in the Work
this License, without any additional terms or conditions. by You to the Licensor shall be under the terms and conditions of
Notwithstanding the above, nothing herein shall supersede or modify this License, without any additional terms or conditions.
the terms of any separate license agreement you may have executed Notwithstanding the above, nothing herein shall supersede or modify
with Licensor regarding such Contributions. 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, 6. Trademarks. This License does not grant permission to use the trade
except as required for reasonable and customary use in describing the names, trademarks, service marks, or product names of the Licensor,
origin of the Work and reproducing the content of the NOTICE file. 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 7. Disclaimer of Warranty. Unless required by applicable law or
Contributor provides its Contributions) on an "AS IS" BASIS, agreed to in writing, Licensor provides the Work (and each
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or Contributor provides its Contributions) on an "AS IS" BASIS,
implied, including, without limitation, any warranties or conditions WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A implied, including, without limitation, any warranties or conditions
PARTICULAR PURPOSE. You are solely responsible for determining the of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
appropriateness of using or redistributing the Work and assume any PARTICULAR PURPOSE. You are solely responsible for determining the
risks associated with Your exercise of permissions under this License. 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, 8. Limitation of Liability. In no event and under no legal theory,
unless required by applicable law (such as deliberate and grossly whether in tort (including negligence), contract, or otherwise,
negligent acts) or agreed to in writing, shall any Contributor be unless required by applicable law (such as deliberate and grossly
liable to You for damages, including any direct, indirect, special, negligent acts) or agreed to in writing, shall any Contributor be
incidental, or consequential damages of any character arising as a liable to You for damages, including any direct, indirect, special,
result of this License or out of the use or inability to use the incidental, or consequential damages of any character arising as a
Work (including but not limited to damages for loss of goodwill, result of this License or out of the use or inability to use the
work stoppage, computer failure or malfunction, or any and all Work (including but not limited to damages for loss of goodwill,
other commercial damages or losses), even if such Contributor work stoppage, computer failure or malfunction, or any and all
has been advised of the possibility of such damages. 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, 9. Accepting Warranty or Additional Liability. While redistributing
and charge a fee for, acceptance of support, warranty, indemnity, the Work or Derivative Works thereof, You may choose to offer,
or other liability obligations and/or rights consistent with this and charge a fee for, acceptance of support, warranty, indemnity,
License. However, in accepting such obligations, You may act only or other liability obligations and/or rights consistent with this
on Your own behalf and on Your sole responsibility, not on behalf License. However, in accepting such obligations, You may act only
of any other Contributor, and only if You agree to indemnify, on Your own behalf and on Your sole responsibility, not on behalf
defend, and hold each Contributor harmless for any liability of any other Contributor, and only if You agree to indemnify,
incurred by, or claims asserted against, such Contributor by reason defend, and hold each Contributor harmless for any liability
of your accepting any such warranty or additional 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
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
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 "[]" To apply the Apache License to your work, attach the following
replaced with your own identifying information. (Don't include boilerplate notice, with the fields enclosed by brackets "[]"
the brackets!) The text should be enclosed in the appropriate replaced with your own identifying information. (Don't include
comment syntax for the file format. We also recommend that a the brackets!) The text should be enclosed in the appropriate
file or class name and description of purpose be included on the comment syntax for the file format. We also recommend that a
same "printed page" as the copyright notice for easier file or class name and description of purpose be included on the
identification within third-party archives. same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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. Licensed under the Apache License, Version 2.0 (the "License");
You may obtain a copy of the License at 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
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, Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
limitations under the License. See the License for the specific language governing permissions and
limitations under the License.
Some code in src/java/org/apache/lucene/util/UnicodeUtil.java was
derived from unicode conversion examples available at Some code in src/Lucene.Net/Util/UnicodeUtil.cs was derived from unicode
http://www.unicode.org/Public/PROGRAMS/CVTUTF. Here is the copyright conversion examples available at http://www.unicode.org/Public/PROGRAMS/CVTUTF.
from those sources:
Here is the copyright from those sources:
/*
* Copyright 2001-2004 Unicode, Inc. /*
* * Copyright 2001-2004 Unicode, Inc.
* Disclaimer *
* * Disclaimer
* This source code is provided as is by Unicode, Inc. No claims are *
* made as to fitness for any particular purpose. No warranties of any * This source code is provided as is by Unicode, Inc. No claims are
* kind are expressed or implied. The recipient agrees to determine * made as to fitness for any particular purpose. No warranties of any
* applicability of information provided. If this file has been * kind are expressed or implied. The recipient agrees to determine
* purchased on magnetic or optical media from Unicode, Inc., the * applicability of information provided. If this file has been
* sole remedy for any claim will be exchange of defective media * purchased on magnetic or optical media from Unicode, Inc., the
* within 90 days of receipt. * sole remedy for any claim will be exchange of defective media
* * within 90 days of receipt.
* Limitations on Rights to Redistribute This Code *
* * Limitations on Rights to Redistribute This Code
* Unicode, Inc. hereby grants the right to freely use the information *
* supplied in this file in the creation of products supporting the * Unicode, Inc. hereby grants the right to freely use the information
* Unicode Standard, and to make copies of this file in any form * supplied in this file in the creation of products supporting the
* for internal or external distribution as long as this notice * Unicode Standard, and to make copies of this file in any form
* remains attached. * for internal or external distribution as long as this notice
*/ * remains attached.
*/
Some code in src/java/org/apache/lucene/util/ArrayUtil.java was
derived from Python 2.4.2 sources available at Some code in src/Lucene.Net/Util/ArrayUtil.cs was derived from Python 2.4.2
http://www.python.org. Full license is here: sources available at http://www.python.org.
http://www.python.org/download/releases/2.4.2/license/ Full license is here:
http://www.python.org/download/releases/2.4.2/license/
The following license applies to the Snowball's Portuguese, Hungarian, Romanian, Turkish stemmers:
Copyright (c) 2001, Dr Martin Porter
Copyright (c) 2002, Richard Boulton
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holders nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

1
lib/lucene.net/patch.txt Normal file
View File

@@ -0,0 +1 @@
This is a modified version including a [assembly: SecutiryTransparent] attribute in AssemblyInfo.cs

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using Lucene.Models; using Lucene.Models;
using Lucene.Net.Index; using Lucene.Net.Index;
@@ -166,7 +167,9 @@ namespace Lucene.Services {
return; return;
} }
if (_boost != 0) { // comparing floating-point numbers using an epsilon value
const double epsilon = 0.001;
if (Math.Abs(_boost - 0) > epsilon) {
_query.SetBoost(_boost); _query.SetBoost(_boost);
} }
@@ -312,7 +315,7 @@ namespace Lucene.Services {
Logger.Debug("Searching: {0}", query.ToString()); Logger.Debug("Searching: {0}", query.ToString());
searcher.Search(query, collector); searcher.Search(query, collector);
var results = collector.TopDocs().scoreDocs var results = collector.TopDocs().ScoreDocs
.Skip(_skip) .Skip(_skip)
.Select(scoreDoc => new LuceneSearchHit(searcher.Doc(scoreDoc.doc), scoreDoc.score)) .Select(scoreDoc => new LuceneSearchHit(searcher.Doc(scoreDoc.doc), scoreDoc.score))
.ToList(); .ToList();
@@ -342,8 +345,8 @@ namespace Lucene.Services {
try { try {
var hits = searcher.Search(query, Int16.MaxValue); var hits = searcher.Search(query, Int16.MaxValue);
Logger.Information("Search results: {0}", hits.scoreDocs.Length); Logger.Information("Search results: {0}", hits.ScoreDocs.Length);
var length = hits.scoreDocs.Length; var length = hits.ScoreDocs.Length;
return Math.Min(length - _skip, _count); return Math.Min(length - _skip, _count);
} }
finally { finally {
@@ -353,13 +356,13 @@ namespace Lucene.Services {
} }
public ISearchHit Get(int documentId) { public ISearchHit Get(int documentId) {
var query = new TermQuery(new Term("id", documentId.ToString())); var query = new TermQuery(new Term("id", documentId.ToString(CultureInfo.InvariantCulture)));
var searcher = new IndexSearcher(_directory, true); var searcher = new IndexSearcher(_directory, true);
try { try {
var hits = searcher.Search(query, 1); var hits = searcher.Search(query, 1);
Logger.Information("Search results: {0}", hits.scoreDocs.Length); Logger.Information("Search results: {0}", hits.ScoreDocs.Length);
return hits.scoreDocs.Length > 0 ? new LuceneSearchHit(searcher.Doc(hits.scoreDocs[0].doc), hits.scoreDocs[0].score) : null; return hits.ScoreDocs.Length > 0 ? new LuceneSearchHit(searcher.Doc(hits.ScoreDocs[0].doc), hits.ScoreDocs[0].score) : null;
} }
finally { finally {
searcher.Close(); searcher.Close();