mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +08:00
Upgrading to Lucene.Net 2.9.4.1
--HG-- branch : 1.x
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
@@ -202,10 +203,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Some code in src/java/org/apache/lucene/util/UnicodeUtil.java was
|
Some code in src/Lucene.Net/Util/UnicodeUtil.cs was derived from unicode
|
||||||
derived from unicode conversion examples available at
|
conversion examples available at http://www.unicode.org/Public/PROGRAMS/CVTUTF.
|
||||||
http://www.unicode.org/Public/PROGRAMS/CVTUTF. Here is the copyright
|
|
||||||
from those sources:
|
Here is the copyright from those sources:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2004 Unicode, Inc.
|
* Copyright 2001-2004 Unicode, Inc.
|
||||||
@@ -230,10 +231,41 @@ from those sources:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
Some code in src/java/org/apache/lucene/util/ArrayUtil.java was
|
Some code in src/Lucene.Net/Util/ArrayUtil.cs was derived from Python 2.4.2
|
||||||
derived from Python 2.4.2 sources available at
|
sources available at http://www.python.org.
|
||||||
http://www.python.org. Full license is here:
|
|
||||||
|
Full license is here:
|
||||||
|
|
||||||
http://www.python.org/download/releases/2.4.2/license/
|
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
1
lib/lucene.net/patch.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This is a modified version including a [assembly: SecutiryTransparent] attribute in AssemblyInfo.cs
|
@@ -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();
|
||||||
|
Reference in New Issue
Block a user