updated some copy is all and started creating a search test but need more info.

This commit is contained in:
Shannon Deminick
2013-02-14 06:33:48 +06:00
parent 73714c7cef
commit 766cf56a3f
3 changed files with 21 additions and 7 deletions

View File

@@ -290,6 +290,7 @@
<Compile Include="UmbracoExamine\IndexInitializer.cs" />
<Compile Include="UmbracoExamine\IndexTest.cs" />
<Compile Include="UmbracoExamine\PdfIndexerTests.cs" />
<Compile Include="UmbracoExamine\SearchTests.cs" />
<Compile Include="UmbracoExamine\TestDataService.cs" />
<Compile Include="UmbracoExamine\TestFiles.Designer.cs">
<AutoGen>True</AutoGen>

View File

@@ -2,6 +2,7 @@
using System.Linq;
using Examine;
using Examine.LuceneEngine.Providers;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using UmbracoExamine;
using UmbracoExamine.PDF;
@@ -13,9 +14,16 @@ namespace Umbraco.Tests.UmbracoExamine
/// </summary>
internal static class IndexInitializer
{
public static UmbracoContentIndexer GetUmbracoIndexer(Lucene.Net.Store.Directory luceneDir)
public static UmbracoContentIndexer GetUmbracoIndexer(
Lucene.Net.Store.Directory luceneDir,
Analyzer analyzer = null)
{
if (analyzer == null)
{
analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29);
}
var i = new UmbracoContentIndexer(new IndexCriteria(
new[]
{
@@ -33,7 +41,7 @@ namespace Umbraco.Tests.UmbracoExamine
-1),
luceneDir, //custom lucene directory
new TestDataService(),
new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
analyzer,
false);
//i.IndexSecondsInterval = 1;
@@ -42,10 +50,13 @@ namespace Umbraco.Tests.UmbracoExamine
return i;
}
public static UmbracoExamineSearcher GetUmbracoSearcher(Lucene.Net.Store.Directory luceneDir)
public static UmbracoExamineSearcher GetUmbracoSearcher(Lucene.Net.Store.Directory luceneDir, Analyzer analyzer = null)
{
return new UmbracoExamineSearcher(luceneDir, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));
if (analyzer == null)
{
analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29);
}
return new UmbracoExamineSearcher(luceneDir, analyzer);
}
//public static SimpleDataIndexer GetSimpleIndexer(Lucene.Net.Store.Directory luceneDir)
//{

View File

@@ -149,8 +149,10 @@ namespace Umbraco.Web
internal IPublishedContent ConvertFromSearchResult(SearchResult searchResult)
{
//TODO: Some fields will not be included, that just the way it is unfortunatley until this is fixed:
// http://examine.codeplex.com/workitem/10350
//NOTE: Some fields will not be included if the config section for the internal index has been
//mucked around with. It should index everything and so the index definition should simply be:
// <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/" />
var values = new Dictionary<string, string>(searchResult.Fields);
//we need to ensure some fields exist, because of the above issue