'Lucene.Services.LuceneSearchBuilder' does not implement interface member 'Orchard.Indexing.ISearchBuilder

Topics: Troubleshooting
Oct 24, 2011 at 2:51 AM

 

I installed Index, then Search then tried to install Lucene and I get this exception ...  

 

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0535: 'Lucene.Services.LuceneSearchBuilder' does not implement interface member 'Orchard.Indexing.ISearchBuilder.WithField(string, float)'

Source Error:

 
Line 12: 
Line 13: namespace Lucene.Services {
Line 14:     public class LuceneSearchBuilder : ISearchBuilder {
Line 15: 
Line 16:         private const int MaxResults = Int16.MaxValue;


Source File: e:\web\softland\Modules\Lucene\Services\LuceneSearchBuilder.cs Line: 14


Show Detailed Compiler Output:

C:\Windows\SysWOW64\inetsrv> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\5d5f4afa\000c6243_edf7cb01\Autofac.Integration.Web.Mvc.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\d594cbe8\000c6243_edf7cb01\Antlr3.Runtime.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Routing\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Routing.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\4a2b1e3d\000c6243_edf7cb01\FluentNHibernate.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\b260334b\000c6243_edf7cb01\NHibernate.ByteCode.Castle.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\281633f8\000c6243_edf7cb01\ClaySharp.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\0c7d7030\000c6243_edf7cb01\Castle.DynamicProxy2.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\0e659df6\000c6243_edf7cb01\System.Web.WebPages.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\7a259dfe\000c6243_edf7cb01\System.Web.Mvc.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\7022098f\000c6243_edf7cb01\NHibernate.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"E:\web\softland\App_Data\Dependencies\Lucene.Net.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\ad41db96\001a894a_edf7cb01\Orchard.Framework.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\7564e48f\0074eb4c_edf7cb01\Orchard.Web.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\48e93a26\000c6243_edf7cb01\log4net.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\f832b021\000c6243_edf7cb01\Castle.Core.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\af499211\000c6243_edf7cb01\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\b4463e68\00399344_edf7cb01\System.Data.SqlServerCe.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\c30b4626\000c6243_edf7cb01\Autofac.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\ba9901b2\000c6243_edf7cb01\Autofac.Integration.Web.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\8362c4c1\000c6243_edf7cb01\NHibernate.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\b75ce218\000c6243_edf7cb01\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Abstractions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Abstractions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\afe7e2b0\000c6243_edf7cb01\WebMatrix.Data.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_global.asax.7uq2o-hb.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\50826912\000c6243_edf7cb01\Autofac.Configuration.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\0ed5da08\000c6243_edf7cb01\System.Web.Razor.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\a9a7f148\000c6243_edf7cb01\Iesi.Collections.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\4a87dab6\000c6243_edf7cb01\Microsoft.Web.Infrastructure.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\01c4e5bf\000c6243_edf7cb01\System.Web.WebPages.Razor.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\de2da784\0047ba4b_edf7cb01\Orchard.Core.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\e52aea17\0047ba4b_edf7cb01\Orchard.WarmupStarter.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701 /warnaserror-  "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.0.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.1.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.2.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.3.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.4.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\App_Web_lucene.csproj.509c2f2e.d2jkjyik.5.cs"


Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.

e:\web\softland\Modules\Lucene\Services\LuceneSearchBuilder.cs(14,18): error CS0535: 'Lucene.Services.LuceneSearchBuilder' does not implement interface member 'Orchard.Indexing.ISearchBuilder.WithField(string, float)'
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\ad41db96\001a894a_edf7cb01\Orchard.Framework.DLL: (Location of symbol related to previous error)
e:\web\softland\Modules\Lucene\Services\LuceneSearchBuilder.cs(14,18): error CS0535: 'Lucene.Services.LuceneSearchBuilder' does not implement interface member 'Orchard.Indexing.ISearchBuilder.WithinRange(string, float, float)'
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\ad41db96\001a894a_edf7cb01\Orchard.Framework.DLL: (Location of symbol related to previous error)
e:\web\softland\Modules\Lucene\Services\LuceneSearchBuilder.cs(14,18): error CS0535: 'Lucene.Services.LuceneSearchBuilder' does not implement interface member 'Orchard.Indexing.ISearchBuilder.SortByFloat(string)'
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\eaacf491\49e58880\assembly\dl3\ad41db96\001a894a_edf7cb01\Orchard.Framework.DLL: (Location of symbol related to previous error)


Show Complete Compilation Source:

Line 1:    using System;
Line 2:    using System.Collections.Generic;
Line 3:    using System.Linq;
Line 4:    using Lucene.Models;
Line 5:    using Lucene.Net.Index;
Line 6:    using Lucene.Net.Search;
Line 7:    using Lucene.Net.Store;
Line 8:    using Orchard.Indexing;
Line 9:    using Orchard.Logging;
Line 10:   using Lucene.Net.Documents;
Line 11:   using Lucene.Net.QueryParsers;
Line 12:   
Line 13:   namespace Lucene.Services {
Line 14:       public class LuceneSearchBuilder : ISearchBuilder {
Line 15:   
Line 16:           private const int MaxResults = Int16.MaxValue;
Line 17:   
Line 18:           private readonly Directory _directory;
Line 19:   
Line 20:           private readonly List<BooleanClause> _clauses;
Line 21:           private readonly List<BooleanClause> _filters;
Line 22:           private int _count;
Line 23:           private int _skip;
Line 24:           private string _sort;
Line 25:           private int _comparer;
Line 26:           private bool _sortDescending;
Line 27:           private bool _asFilter;
Line 28:   
Line 29:           // pending clause attributes
Line 30:           private BooleanClause.Occur _occur;
Line 31:           private bool _exactMatch;
Line 32:           private float _boost;
Line 33:           private Query _query;
Line 34:   
Line 35:           public ILogger Logger { get; set; }
Line 36:   
Line 37:           public LuceneSearchBuilder(Directory directory) {
Line 38:               _directory = directory;
Line 39:               Logger = NullLogger.Instance;
Line 40:   
Line 41:               _count = MaxResults;
Line 42:               _skip = 0;
Line 43:               _clauses = new List<BooleanClause>();
Line 44:               _filters = new List<BooleanClause>();
Line 45:               _sort = String.Empty;
Line 46:               _comparer = 0;
Line 47:               _sortDescending = true;
Line 48:   
Line 49:               InitPendingClause();
Line 50:           }
Line 51:   
Line 52:           public ISearchBuilder Parse(string defaultField, string query, bool escape, bool mandatory) {
Line 53:               return Parse(new[] {defaultField}, query, escape, mandatory);
Line 54:           }
Line 55:           
Line 56:           public ISearchBuilder Parse(string[] defaultFields, string query, bool escape, bool mandatory) {
Line 57:               if ( defaultFields.Length == 0 ) {
Line 58:                   throw new ArgumentException("Default field can't be empty");
Line 59:               }
Line 60:   
Line 61:               if ( String.IsNullOrWhiteSpace(query) ) {
Line 62:                   throw new ArgumentException("Query can't be empty");
Line 63:               }
Line 64:   
Line 65:               if (escape) {
Line 66:                   query = QueryParser.Escape(query);
Line 67:               }
Line 68:   
Line 69:               var analyzer = LuceneIndexProvider.CreateAnalyzer();
Line 70:               foreach ( var defaultField in defaultFields ) {
Line 71:                   var clause = new BooleanClause(new QueryParser(LuceneIndexProvider.LuceneVersion, defaultField, analyzer).Parse(query), mandatory ? BooleanClause.Occur.MUST : BooleanClause.Occur.SHOULD);
Line 72:                   _clauses.Add(clause);
Line 73:               }
Line 74:               
Line 75:               _query = null;
Line 76:               return this;
Line 77:           }
Line 78:   
Line 79:           public ISearchBuilder WithField(string field, int value) {
Line 80:               CreatePendingClause();
Line 81:               _query = NumericRangeQuery.NewIntRange(field, value, value, true, true);
Line 82:               return this;
Line 83:           }
Line 84:   
Line 85:           public ISearchBuilder WithinRange(string field, int min, int max) {
Line 86:               CreatePendingClause();
Line 87:               _query = NumericRangeQuery.NewIntRange(field, min, max, true, true);
Line 88:               return this;
Line 89:           }
Line 90:   
Line 91:           public ISearchBuilder WithField(string field, double value) {
Line 92:               CreatePendingClause();
Line 93:               _query = NumericRangeQuery.NewDoubleRange(field, value, value, true, true);
Line 94:               return this;
Line 95:           }
Line 96:   
Line 97:           public ISearchBuilder WithinRange(string field, double min, double max) {
Line 98:               CreatePendingClause();
Line 99:               _query = NumericRangeQuery.NewDoubleRange(field, min, max, true, true);
Line 100:              return this;
Line 101:          }
Line 102:  
Line 103:          public ISearchBuilder WithField(string field, bool value) {
Line 104:              return WithField(field, value ? 1 : 0);
Line 105:          }
Line 106:  
Line 107:          public ISearchBuilder WithField(string field, DateTime value) {
Line 108:              CreatePendingClause();
Line 109:              _query = new TermQuery(new Term(field, DateTools.DateToString(value, DateTools.Resolution.MILLISECOND)));
Line 110:              return this;
Line 111:          }
Line 112:  
Line 113:          public ISearchBuilder WithinRange(string field, DateTime min, DateTime max) {
Line 114:              CreatePendingClause();
Line 115:              _query = new TermRangeQuery(field, DateTools.DateToString(min, DateTools.Resolution.MILLISECOND), DateTools.DateToString(max, DateTools.Resolution.MILLISECOND), true, true);
Line 116:              return this;
Line 117:          }
Line 118:  
Line 119:          public ISearchBuilder WithinRange(string field, string min, string max) {
Line 120:              CreatePendingClause();
Line 121:              _query = new TermRangeQuery(field, QueryParser.Escape(min.ToLower()), QueryParser.Escape(max.ToLower()), true, true);
Line 122:              return this;
Line 123:          }
Line 124:  
Line 125:          public ISearchBuilder WithField(string field, string value) {
Line 126:              CreatePendingClause();
Line 127:  
Line 128:              if ( !String.IsNullOrWhiteSpace(value) ) {
Line 129:                  _query = new TermQuery(new Term(field, QueryParser.Escape(value.ToLower())));
Line 130:              }
Line 131:              
Line 132:              return this;
Line 133:          }
Line 134:  
Line 135:          public ISearchBuilder Mandatory() {
Line 136:              _occur = BooleanClause.Occur.MUST;
Line 137:              return this;
Line 138:          }
Line 139:  
Line 140:          public ISearchBuilder Forbidden() {
Line 141:              _occur = BooleanClause.Occur.MUST_NOT;
Line 142:              return this;
Line 143:          }
Line 144:  
Line 145:          public ISearchBuilder ExactMatch() {
Line 146:              _exactMatch = true;
Line 147:              return this;
Line 148:          }
Line 149:  
Line 150:          public ISearchBuilder Weighted(float weight) {
Line 151:              _boost = weight;
Line 152:              return this;
Line 153:          }
Line 154:  
Line 155:          private void InitPendingClause() {
Line 156:              _occur = BooleanClause.Occur.SHOULD;
Line 157:              _exactMatch = false;
Line 158:              _query = null;
Line 159:              _boost = 0;
Line 160:              _asFilter = false;
Line 161:              _sort = String.Empty;
Line 162:              _comparer = 0;
Line 163:          }
Line 164:  
Line 165:          private void CreatePendingClause() {
Line 166:              if(_query == null) {
Line 167:                  return;
Line 168:              }
Line 169:  
Line 170:              if (_boost != 0) {
Line 171:                  _query.SetBoost(_boost);
Line 172:              }
Line 173:  
Line 174:              if(!_exactMatch) {
Line 175:                  var termQuery = _query as TermQuery;
Line 176:                  if(termQuery != null) {
Line 177:                      var term = termQuery.GetTerm();
Line 178:                      // prefixed queries are case sensitive
Line 179:                      _query = new PrefixQuery(term);
Line 180:                  }
Line 181:              }
Line 182:              if ( _asFilter ) {
Line 183:                  _filters.Add(new BooleanClause(_query, _occur));
Line 184:              }
Line 185:              else {
Line 186:                  _clauses.Add(new BooleanClause(_query, _occur));
Line 187:              }
Line 188:          }
Line 189:  
Line 190:          public ISearchBuilder SortBy(string name)
Line 191:          {
Line 192:              _sort = name;
Line 193:              _comparer = 0;
Line 194:              return this;
Line 195:          }
Line 196:  
Line 197:          public ISearchBuilder SortByInteger(string name) {
Line 198:              _sort = name;
Line 199:              _comparer = SortField.INT;
Line 200:              return this;
Line 201:          }
Line 202:  
Line 203:          public ISearchBuilder SortByBoolean(string name) {
Line 204:              return SortByInteger(name);
Line 205:          }
Line 206:  
Line 207:          public ISearchBuilder SortByString(string name) {
Line 208:              _sort = name;
Line 209:              _comparer = SortField.STRING;
Line 210:              return this;
Line 211:          }
Line 212:  
Line 213:          public ISearchBuilder SortByDouble(string name) {
Line 214:              _sort = name;
Line 215:              _comparer = SortField.DOUBLE;
Line 216:              return this;
Line 217:          }
Line 218:  
Line 219:          public ISearchBuilder SortByDateTime(string name)
Line 220:          {
Line 221:              _sort = name;
Line 222:              _comparer = SortField.LONG;
Line 223:              return this;
Line 224:          }
Line 225:  
Line 226:          public ISearchBuilder Ascending()
Line 227:          {
Line 228:              _sortDescending = false;
Line 229:              return this;
Line 230:          }
Line 231:  
Line 232:          public ISearchBuilder AsFilter() {
Line 233:              _asFilter = true;
Line 234:              return this;
Line 235:          }
Line 236:  
Line 237:          public ISearchBuilder Slice(int skip, int count) {
Line 238:              if ( skip < 0 ) {
Line 239:                  throw new ArgumentException("Skip must be greater or equal to zero");
Line 240:              }
Line 241:  
Line 242:              if ( count <= 0 ) {
Line 243:                  throw new ArgumentException("Count must be greater than zero");
Line 244:              }
Line 245:  
Line 246:              _skip = skip;
Line 247:              _count = count;
Line 248:              
Line 249:              return this;
Line 250:          }
Line 251:  
Line 252:          private Query CreateQuery() {
Line 253:              CreatePendingClause();
Line 254:  
Line 255:              var booleanQuery = new BooleanQuery();
Line 256:              Query resultQuery = booleanQuery;
Line 257:  
Line 258:              if (_clauses.Count == 0) {
Line 259:                  if (_filters.Count > 0) { // only filters applieds => transform to a boolean query
Line 260:                      foreach (var clause in _filters) {
Line 261:                          booleanQuery.Add(clause);
Line 262:                      }
Line 263:  
Line 264:                      resultQuery = booleanQuery;
Line 265:                  }
Line 266:                  else { // search all documents, without filter or clause
Line 267:                      resultQuery = new MatchAllDocsQuery(null); 
Line 268:                  }
Line 269:              }
Line 270:              else {
Line 271:                  foreach (var clause in _clauses)
Line 272:                      booleanQuery.Add(clause);
Line 273:  
Line 274:                  if (_filters.Count > 0) {
Line 275:                      var filter = new BooleanQuery();
Line 276:                      foreach (var clause in _filters)
Line 277:                          filter.Add(clause);
Line 278:                      var queryFilter = new QueryWrapperFilter(filter);
Line 279:  
Line 280:                      resultQuery = new FilteredQuery(booleanQuery, queryFilter);
Line 281:                  }
Line 282:              }
Line 283:  
Line 284:              Logger.Debug("New search query: {0}", resultQuery.ToString());
Line 285:              return resultQuery;
Line 286:          }
Line 287:  
Line 288:          public IEnumerable<ISearchHit> Search() {
Line 289:              var query = CreateQuery();
Line 290:              
Line 291:              IndexSearcher searcher;
Line 292:  
Line 293:              try {
Line 294:                  searcher = new IndexSearcher(_directory, true);
Line 295:              }
Line 296:              catch {
Line 297:                  // index might not exist if it has been rebuilt
Line 298:                  Logger.Information("Attempt to read a none existing index");
Line 299:                  return Enumerable.Empty<ISearchHit>();
Line 300:              }
Line 301:  
Line 302:              try {
Line 303:                  var sort = String.IsNullOrEmpty(_sort)
Line 304:                                 ? Sort.RELEVANCE
Line 305:                                 : new Sort(new SortField(_sort, _comparer, _sortDescending));
Line 306:                  var collector = TopFieldCollector.create(
Line 307:                      sort,
Line 308:                      _count + _skip,
Line 309:                      false,
Line 310:                      true,
Line 311:                      false,
Line 312:                      true);
Line 313:  
Line 314:                  Logger.Debug("Searching: {0}", query.ToString());
Line 315:                  searcher.Search(query, collector);
Line 316:  
Line 317:                  var results = collector.TopDocs().scoreDocs
Line 318:                      .Skip(_skip)
Line 319:                      .Select(scoreDoc => new LuceneSearchHit(searcher.Doc(scoreDoc.doc), scoreDoc.score))
Line 320:                      .ToList();
Line 321:  
Line 322:                  Logger.Debug("Search results: {0}", results.Count);
Line 323:  
Line 324:                  return results;
Line 325:              }
Line 326:              finally {
Line 327:                  searcher.Close();
Line 328:              }
Line 329:  
Line 330:          }
Line 331:  
Line 332:          public int Count() {
Line 333:              var query = CreateQuery();
Line 334:              IndexSearcher searcher;
Line 335:              
Line 336:              try {
Line 337:                   searcher = new IndexSearcher(_directory, true);
Line 338:              }
Line 339:              catch {
Line 340:                  // index might not exist if it has been rebuilt
Line 341:                  Logger.Information("Attempt to read a none existing index");
Line 342:                  return 0;
Line 343:              }
Line 344:  
Line 345:              try {
Line 346:                  var hits = searcher.Search(query, Int16.MaxValue);
Line 347:                  Logger.Information("Search results: {0}", hits.scoreDocs.Length);
Line 348:                  var length = hits.scoreDocs.Length;
Line 349:                  return Math.Min(length - _skip, _count) ;
Line 350:              }
Line 351:              finally {
Line 352:                  searcher.Close();
Line 353:              }
Line 354:              
Line 355:          }
Line 356:  
Line 357:          public ISearchHit Get(int documentId) {
Line 358:              var query = new TermQuery(new Term("id", documentId.ToString()));
Line 359:  
Line 360:              var searcher = new IndexSearcher(_directory, true);
Line 361:              try {
Line 362:                  var hits = searcher.Search(query, 1);
Line 363:                  Logger.Information("Search results: {0}", hits.scoreDocs.Length);
Line 364:                  return hits.scoreDocs.Length > 0 ? new LuceneSearchHit(searcher.Doc(hits.scoreDocs[0].doc), hits.scoreDocs[0].score) : null;
Line 365:              }
Line 366:              finally {
Line 367:                  searcher.Close();
Line 368:              }
Line 369:          }
Line 370:  
Line 371:      }
Line 372:  }
Line 373:  




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.233

<!-- [HttpCompileException]: e:\web\softland\Modules\Lucene\Services\LuceneSearchBuilder.cs(14): error CS0535: 'Lucene.Services.LuceneSearchBuilder' does not implement interface member 'Orchard.Indexing.ISearchBuilder.WithField(string, float)' at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetCompiledAssembly(String virtualPath) at Orchard.Environment.DefaultBuildManager.GetCompiledAssembly(String virtualPath) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\IBuildManager.cs:line 42 at Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader.LoadWorker(ExtensionDescriptor descriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\Loaders\DynamicExtensionLoader.cs:line 168 at Orchard.Environment.Extensions.Loaders.ExtensionLoaderBase.Load(ExtensionDescriptor descriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\Loaders\ExtensionLoaderBase.cs:line 37 at Orchard.Environment.Extensions.ExtensionManager.BuildEntry(ExtensionDescriptor descriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 135 at Orchard.Environment.Extensions.ExtensionManager.<>c__DisplayClass18.<LoadFeature>b__13(AcquireContext`1 ctx) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 87 at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:line 41 at Orchard.Caching.Cache`2.<>c__DisplayClass3.<Get>b__0(TKey k) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:line 17 at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:line 15 at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\DefaultCacheManager.cs:line 33 at Orchard.Environment.Extensions.ExtensionManager.LoadFeature(FeatureDescriptor featureDescriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 86 [OrchardException]: Error while loading extension 'Lucene'. at Orchard.Environment.Extensions.ExtensionManager.LoadFeature(FeatureDescriptor featureDescriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 98 at Orchard.Environment.Extensions.ExtensionManager.<>c__DisplayClassf.<LoadFeatures>b__e(AcquireContext`1 ctx) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 75 at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:line 41 at Orchard.Caching.Cache`2.<>c__DisplayClass3.<Get>b__0(TKey k) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:line 17 at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\Cache.cs:line 15 at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Caching\DefaultCacheManager.cs:line 33 at Orchard.Environment.Extensions.ExtensionManager.<LoadFeatures>b__d(FeatureDescriptor descriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 75 at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Orchard.Environment.Extensions.ExtensionManager.LoadFeatures(IEnumerable`1 featureDescriptors) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 74 at Orchard.Environment.ShellBuilders.CompositionStrategy.Compose(ShellSettings settings, ShellDescriptor descriptor) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\ShellBuilders\CompositionStrategy.cs:line 36 at Orchard.Environment.ShellBuilders.ShellContextFactory.CreateShellContext(ShellSettings settings) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\ShellBuilders\ShellContextFactory.cs:line 60 at Orchard.Environment.DefaultOrchardHost.CreateShellContext(ShellSettings settings) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:line 133 at Orchard.Environment.DefaultOrchardHost.<CreateAndActivate>b__4(ShellSettings settings) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:line 105 at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Orchard.Environment.DefaultOrchardHost.BuildCurrent() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:line 92 at Orchard.Environment.DefaultOrchardHost.BeginRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:line 166 at Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.BeginRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard\Environment\DefaultOrchardHost.cs:line 70 at Orchard.WarmupStarter.Starter.OnBeginRequest(HttpContext context, Action`1 registrations) in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Startup\Starter.cs:line 29 at Orchard.Web.MvcApplication.Application_BeginRequest() in d:\TeamCity\Projects\Orchard-Default\src\Orchard.Web\Global.asax.cs:line 24 [TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --><!-- This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->
Coordinator
Oct 24, 2011 at 3:16 AM

My guess would be that you are running Orchard 1.2 and are trying to add 1.3 modules on it.

Oct 24, 2011 at 3:20 AM

Yep I think your right .. I installed Orchard through my Web Host provider (Win Host) and thought it was 1.3 but when I looked just now it is 1.1.30

What's the easiest way to upgrade to 1.3?

Coordinator
Oct 24, 2011 at 3:24 AM

http://orchardproject.net/docs/Upgrading-a-site-to-a-new-version-of-Orchard.ashx