Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Issue with string equality
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ben  
View profile  
 More options May 3 2012, 6:57 pm
From: Ben <b...@planetcloud.co.uk>
Date: Thu, 3 May 2012 15:57:04 -0700 (PDT)
Local: Thurs, May 3 2012 6:57 pm
Subject: Issue with string equality
Hi,

Given the following document:

{
  "FullName": "Ben Foster",

}

The following occurs:

            var user1 = session.Query<User>().FirstOrDefault(u =>
u.FullName == "Ben Foster"); // returns user
            var user2 = session.Query<User>().FirstOrDefault(u =>
u.FullName.Equals("Ben Foster")); // returns null
            var user3 = session.Query<User>().FirstOrDefault(u =>
u.FullName.Equals("Ben Foster", StringComparison.Ordinal)); // returns
null
            var user4 = session.Query<User>().FirstOrDefault(u =>
u.FullName.Equals("Ben Foster",
StringComparison.InvariantCultureIgnoreCase)); // returns user

Is this something to do with the Linq provider as I thought the ==
operator, Equals(string, string) and Equals(string,
StringComparison.Ordinal) effectively did the same thing?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options May 4 2012, 9:49 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 4 May 2012 16:49:28 +0300
Local: Fri, May 4 2012 9:49 am
Subject: Re: [RavenDB] Issue with string equality

Ben,
we don't support Equals(string,  StringComparison)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Marisic  
View profile  
 More options May 4 2012, 10:12 am
From: Chris Marisic <ch...@marisic.com>
Date: Fri, 4 May 2012 07:12:56 -0700 (PDT)
Local: Fri, May 4 2012 10:12 am
Subject: Re: [RavenDB] Issue with string equality

It's redudant to support Equals(string,  StringComparison)  because all of
those comparisons could be facilitated by using an appropriate Lucene
analyzer for the field, correct?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options May 4 2012, 10:19 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 4 May 2012 17:19:01 +0300
Local: Fri, May 4 2012 10:19 am
Subject: Re: [RavenDB] Issue with string equality

Yes


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben  
View profile  
 More options May 4 2012, 3:11 pm
From: Ben <b...@planetcloud.co.uk>
Date: Fri, 4 May 2012 12:11:42 -0700 (PDT)
Local: Fri, May 4 2012 3:11 pm
Subject: Re: Issue with string equality
So by default we are always case insensitive? I'm assuming I need to
create an index for this then?

On May 4, 3:19 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Warren  
View profile  
 More options May 4 2012, 4:47 pm
From: Matt Warren <mattd...@gmail.com>
Date: Fri, 4 May 2012 13:47:10 -0700 (PDT)
Local: Fri, May 4 2012 4:47 pm
Subject: Re: Issue with string equality

Yeah, by default RavenDB uses a custom analyser called "
LowerCaseKeywordAnalyzer". There's a bit more info here
http://ravendb.net/docs/client-api/querying/static-indexes/configurin....

You can change this by specifying a different analyser in the index, so yes
you'll have to create your own index. See the link about for more info.

You write the index something like this:

new IndexDefinitionBuilder<BlogPost, BlogPost>
    {
        Map =  users =>
            from doc in users select new { doc.Tags, doc.Content },
        Analyzers =
            {
                {x => x.Tags, "SimpleAnalyzer"},
                {x => x.Content, "SnowballAnalyzer"}
            },
    });


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »