Index search problem

121 views
Skip to first unread message

Magdalena Tytkowska

unread,
Aug 30, 2016, 6:47:34 AM8/30/16
to RavenDB - 2nd generation document database



Hi, I have a problem with an index search. To reproduce this issue, first you have to create some example models, for example like in the attached picture.

Then I created a new index like this one

Then if I run this query: 
@in<ExampleIdString>:(ExampleModels/2f7392c1\-dc2b\-4199\-9e40\-4d4fc6758c92,ExampleModels/a04abe17\-301a\-4a90\-b1ce\-a6bf7590dd5f,ExampleModels/8f6ff28c\-6923\-4737\-b0c1\-6e2b7134036,ExampleModels/90ce55c0\-d3a8\-4982\-af33\-85a7d525ae01,ExampleModels/3be3bdbc\-34a1\-48d4\-aa28\-de5bc873d510,ExampleModels/5) 
I won't get any results, but if I add a space just before ExampleModels/5, like this:
@in<ExampleIdString>:(ExampleModels/2f7392c1\-dc2b\-4199\-9e40\-4d4fc6758c92,ExampleModels/a04abe17\-301a\-4a90\-b1ce\-a6bf7590dd5f,ExampleModels/8f6ff28c\-6923\-4737\-b0c1\-6e2b7134036,ExampleModels/90ce55c0\-d3a8\-4982\-af33\-85a7d525ae01,ExampleModels/3be3bdbc\-34a1\-48d4\-aa28\-de5bc873d510, ExampleModels/5)
I get the specified models.

Am I correctly defining this query or not? Maybe this issue is caused by something else?

Fitzchak Yitzchaki

unread,
Aug 30, 2016, 7:03:27 AM8/30/16
to <ravendb@googlegroups.com>
Hello,

First of all, the index doesn't make sense as your'e doing map reduce on an ID but ID is unique. In this case it is the same as going with just a map.

Second, it may be that in this case ExampleModels/5 id has a leading space? like " ExampleModels/5"?

What version of RavenDB are you using?


Best Regards,

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Fitzchak Yitzchaki l Senior Software Engineer Mobile:+972-58-345-9538


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Magdalena Tytkowska

unread,
Aug 31, 2016, 5:44:31 AM8/31/16
to RavenDB - 2nd generation document database
I'm using 3.0 version. I hope I created this test correctly:

public class NoResultTestClass : RavenTestBase
    {
        public class ExampleModel
        {
            public string Id;
            public string SearchString;
        }

        public class ExampleIndex : AbstractIndexCreationTask<ExampleModel>
        {
            public ExampleIndex()
            {
                Map = examples => from example in examples
                                  select new
                                  {
                                      Id = example.Id,
                                      SearchString = example.SearchString
                                  };
                Index(x => x.SearchString, FieldIndexing.Analyzed);
            }
        }

        
        [Fact]
        public void NoResultTestMethod()
        {
            using (DocumentStore store = NewRemoteDocumentStore())
            {
                new ExampleIndex().Execute(store);

                using (var session = store.OpenSession())
                {
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/90ce55c0-d3a8-4982-af33-85a7d525ae01",
                        Id = "a"
                    });
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/3be3bdbc-34a1-48d4-aa28-de5bc873d510",
                        Id = "b"
                    });
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/2f7392c1-dc2b-4199-9e40-4d4fc6758c92",
                        Id = "c"
                    });
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/a04abe17-301a-4a90-b1ce-a6bf7590dd5f",
                        Id = "d"
                    });
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/8f6ff28c-6923-4737-b0c1-6e2b7134036",
                        Id = "e"
                    });
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/6",
                        Id = "f"
                    });
                    session.Store(new ExampleModel
                    {
                        SearchString = "ExampleModels/7",
                        Id = "g"
                    });
                    session.SaveChanges();
                }

                WaitForIndexing(store);

                using (var session = store.OpenSession())
                {
                    var ids = new List<string> { "ExampleModels/90ce55c0-d3a8-4982-af33-85a7d525ae01", "ExampleModels/3be3bdbc-34a1-48d4-aa28-de5bc873d510", "ExampleModels/2f7392c1-dc2b-4199-9e40-4d4fc6758c92", "ExampleModels/a04abe17-301a-4a90-b1ce-a6bf7590dd5f", "ExampleModels/8f6ff28c-6923-4737-b0c1-6e2b7134036" };
                    var examples1Query = session.Advanced.DocumentQuery<ExampleModel, ExampleIndex>().WhereIn(x => x.SearchString, ids);
                    var examples1 = examples1Query.ToList();

                    ids.Add("ExampleModels/6");
                    var examples2Query = session.Advanced.DocumentQuery<ExampleModel, ExampleIndex>().WhereIn(x => x.SearchString, ids);
                    var examples2 = examples2Query.ToList();

                    Assert.Equal(5, examples1.Count);
                    Assert.Equal(6, examples2.Count);
                }
            }
        }
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Aug 31, 2016, 8:01:45 AM8/31/16
to ravendb
This tests passes

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Aug 31, 2016, 8:04:34 AM8/31/16
to ravendb

Magdalena Tytkowska

unread,
Sep 1, 2016, 5:46:15 AM9/1/16
to RavenDB - 2nd generation document database
And what version of .NET framework are you using? To be precise I'm using .NET Framework 4.5.2 and Raven 3.0.30153

Oren Eini (Ayende Rahien)

unread,
Sep 4, 2016, 7:06:57 AM9/4/16
to ravendb
I tested that on 3.5, please check it there.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Magdalena Tytkowska

unread,
Sep 5, 2016, 8:04:00 AM9/5/16
to RavenDB - 2nd generation document database
I just tested it, and you're right that it's working on Raven 3.5, but still Raven 3.5 is not yet a stable version and I don't want to use it yet. What do you suggest in this situation?

Idan Haim

unread,
Sep 5, 2016, 10:53:41 AM9/5/16
to RavenDB - 2nd generation document database
Hi,
Thank you for notice us.
Going to make some test to try solve this problem.

Idan Haim

unread,
Sep 7, 2016, 7:54:52 AM9/7/16
to RavenDB - 2nd generation document database
We manage to fix the issue 
just update your client after the merge.

Thank you
Reply all
Reply to author
Forward
0 new messages