Re: [RavenDB] error CS0103: The name 'Vertica' does not exist in the current context

200 views
Skip to first unread message
Message has been deleted

Oren Eini (Ayende Rahien)

unread,
Apr 21, 2012, 5:17:47 AM4/21/12
to rav...@googlegroups.com
typeof (ClubDocument).Name

You are trying to reference a type that exists only on your client, not on the server.
Replace this with a constant, that should work.

On Fri, Apr 20, 2012 at 4:31 PM, Martin Zanoni <zano...@gmail.com> wrote:
Hi,

I am suddenly experiencing a problem with one of my indexcreations,
when ever i try to create ANY index (not limited to the one thats
broken but every index in the same folder) the same index throws this
error:

Url: "/indexes/Region/Count"

System.InvalidOperationException: Source code:
using Raven.Abstractions;
using Raven.Database.Linq;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
using System;
using Raven.Database.Linq.PrivateExtensions;
using Lucene.Net.Documents;
using Raven.Database.Indexing;
public class Index_Region_2fCount : AbstractViewGenerator
{
       public Index_Region_2fCount()
       {
               this.ViewText = @"docs.ClubDocuments
       .SelectMany(club => club.RegionIds, (club, regionId) => new ()
{RegionId = regionId, AllText = club.AllText, DocumentType =
Vertica.Sportica.Model.RavenSearch.Documents.ClubDocument.Name})
docs.MatchDocuments
       .Select(match => new () {RegionId = match.RegionId, AllText =
match.AllText, DocumentType =
Vertica.Sportica.Model.RavenSearch.Documents.MatchDocument.Name})
docs.SquadDocuments
       .SelectMany(squad => squad.RegionIds, (squad, regionId) => new ()
{RegionId = regionId, AllText = squad.AllText, DocumentType =
Vertica.Sportica.Model.RavenSearch.Documents.SquadDocument.Name})
";
               this.ForEntityNames.Add("ClubDocuments");
               this.AddMapDefinition(docs => docs.Where(__document =>
__document["@metadata"]["Raven-Entity-Name"] ==
"ClubDocuments").SelectMany((Func<dynamic, IEnumerable<dynamic>>)(club
=> (IEnumerable<dynamic>)(club.RegionIds)), (Func<dynamic, dynamic,
dynamic>)((club, regionId) => new { RegionId = regionId, AllText =
club.AllText, DocumentType =
Vertica.Sportica.Model.RavenSearch.Documents.ClubDocument.Name,
__document_id = club.__document_id })));
               this.ForEntityNames.Add("MatchDocuments");
               this.AddMapDefinition(docs => docs.Where(__document =>
__document["@metadata"]["Raven-Entity-Name"] ==
"MatchDocuments").Select((Func<dynamic, dynamic>)(match => new
{ RegionId = match.RegionId, AllText = match.AllText, DocumentType =
Vertica.Sportica.Model.RavenSearch.Documents.MatchDocument.Name,
__document_id = match.__document_id })));
               this.ForEntityNames.Add("SquadDocuments");
               this.AddMapDefinition(docs => docs.Where(__document =>
__document["@metadata"]["Raven-Entity-Name"] ==
"SquadDocuments").SelectMany((Func<dynamic, IEnumerable<dynamic>>)
(squad => (IEnumerable<dynamic>)(squad.RegionIds)), (Func<dynamic,
dynamic, dynamic>)((squad, regionId) => new { RegionId = regionId,
AllText = squad.AllText, DocumentType =
Vertica.Sportica.Model.RavenSearch.Documents.SquadDocument.Name,
__document_id = squad.__document_id })));
               this.AddField("RegionId");
               this.AddField("AllText");
               this.AddField("DocumentType");
               this.AddField("__document_id");
       }
}


c:\Program Files (x86)\RavenDB-Build-888\Server\Data\IndexDefinitions
\TemporaryIndexDefinitionsAsSource\5e2i3qu1.0.cs(22,341) : error
CS0103: The name 'Vertica' does not exist in the current context
c:\Program Files (x86)\RavenDB-Build-888\Server\Data\IndexDefinitions
\TemporaryIndexDefinitionsAsSource\5e2i3qu1.0.cs(24,238) : error
CS0103: The name 'Vertica' does not exist in the current context
c:\Program Files (x86)\RavenDB-Build-888\Server\Data\IndexDefinitions
\TemporaryIndexDefinitionsAsSource\5e2i3qu1.0.cs(26,346) : error
CS0103: The name 'Vertica' does not exist in the current context

  at Raven.Database.Linq.QueryParsingUtils.Compile(String source,
String name, String queryText, OrderedPartCollection`1 extensions,
String basePath) in c:\Builds\RavenDB-Stable\Raven.Database\Linq
\QueryParsingUtils.cs:line 270
  at Raven.Database.Linq.DynamicViewCompiler.GenerateInstance() in c:
\Builds\RavenDB-Stable\Raven.Database\Linq\DynamicViewCompiler.cs:line
491
  at
Raven.Database.Storage.IndexDefinitionStorage.AddAndCompileIndex(IndexDefinition
indexDefinition) in c:\Builds\RavenDB-Stable\Raven.Database\Storage
\IndexDefinitionStorage.cs:line 150
  at
Raven.Database.Storage.IndexDefinitionStorage.CreateAndPersistIndex(IndexDefinition
indexDefinition) in c:\Builds\RavenDB-Stable\Raven.Database\Storage
\IndexDefinitionStorage.cs:line 135
  at Raven.Database.DocumentDatabase.PutIndex(String name,
IndexDefinition definition) in c:\Builds\RavenDB-Stable\Raven.Database
\DocumentDatabase.cs:line 731
  at Raven.Database.Server.Responders.Index.Put(IHttpContext context,
String index) in c:\Builds\RavenDB-Stable\Raven.Database\Server
\Responders\Index.cs:line 71
  at Raven.Database.Server.Responders.Index.Respond(IHttpContext
context) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders
\Index.cs:line 48
  at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext
ctx) in c:\Builds\RavenDB-Stable\Raven.Database\Server
\HttpServer.cs:line 548
  at
Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx)
in c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs:line
315

My index looks like this:

using Raven.Abstractions.Indexing;
using Raven.Client.Indexes;
using System.Linq;
using Vertica.Sportica.Model.RavenSearch.Documents;

namespace Vertica.Sportica.Model.RavenSearch.Indexes
{
   public class Region_Count :
AbstractMultiMapIndexCreationTask<Region_Count.ReduceResult>
   {
       public Region_Count()
       {
           AddMap<ClubDocument>(clubs => from club in clubs
                                         from regionId in
club.RegionIds
                                         select
                                             new ReduceResult
                                                 {
                                                     RegionId =
regionId,
                                                     AllText =
club.AllText,
                                                     DocumentType =
typeof (ClubDocument).Name
                                                 });
           AddMap<MatchDocument>((matches => from match in matches
                                             select
                                                 new ReduceResult
                                                     {
                                                         RegionId =
match.RegionId,
                                                         AllText =
match.AllText,
                                                         DocumentType
= typeof (MatchDocument).Name
                                                     }));

           AddMap<SquadDocument>((squads => from squad in squads
                                            from regionId in
squad.RegionIds
                                            select
                                                new ReduceResult
                                                    {
                                                        RegionId =
regionId,
                                                        AllText =
squad.AllText,
                                                        DocumentType
= typeof (SquadDocument).Name
                                                    }));

           Index(x => x.RegionId, FieldIndexing.Analyzed);
           Index(x => x.AllText, FieldIndexing.Analyzed);
       }

       #region Nested type: ReduceResult

       public class ReduceResult : BaseReduceResult
       {
           public int RegionId { get; set; }
           public string DocumentType { get; set; }
       }

       #endregion
   }
}

I made the index about a month ago using the 616 build and didnt touch
it until 2 days ago where i added a new index (i tried removing this
new index creation but it made no difference), wanting to update the
content on my ravendb, i ran all my indexes and migrated my data from
a MS SQL server where i also keep all the data. Im just using ravendb
for searching. And this error appered out of no where. I have update
all my c# packages with nuget and updated my raven server to build
888. Since this error i have not been able to remake any of my indexes
but i can query my documents and add all the documents i want to. I
was hoping that someone here could tell me what is wrong with my code.

Martin Zanoni

unread,
Apr 23, 2012, 2:21:04 AM4/23/12
to ravendb
Wauw, that has been working like the last 5 times I have run that
piece of code and suddenly it stops working! Thanks a lot for the fast
response to my problem! couldnt get to a computer all weekend, so
sorry for my late response.

Thanks again :)

On Apr 21, 11:17 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
> > Raven.Database.Storage.IndexDefinitionStorage.AddAndCompileIndex(IndexDefin­ition
> > indexDefinition) in c:\Builds\RavenDB-Stable\Raven.Database\Storage
> > \IndexDefinitionStorage.cs:line 150
> >   at
>
> > Raven.Database.Storage.IndexDefinitionStorage.CreateAndPersistIndex(IndexDe­finition
Reply all
Reply to author
Forward
0 new messages