Giter Club home page Giter Club logo

Comments (10)

arekpalinski avatar arekpalinski commented on June 18, 2024

Hi @KresoJ

What version of RavenDB did you test it on? We released version 6.0.102 today which contains some fixes in similar area in Corax. Could you check it?

from ravendb.

KresoJ avatar KresoJ commented on June 18, 2024

Thank you @arekpalinski, we are on 6.0.101 now. I will upgrade later today and try.

from ravendb.

KresoJ avatar KresoJ commented on June 18, 2024

Unfortunately, the issue is still there.

from ravendb.

arekpalinski avatar arekpalinski commented on June 18, 2024

Ok. Do you think you could narrow it down to a failing test - https://ravendb.net/docs/article-page/6.0/csharp/start/test-driver?

from ravendb.

KresoJ avatar KresoJ commented on June 18, 2024

Sure, will do that. Probably not before Thursday.

from ravendb.

KresoJ avatar KresoJ commented on June 18, 2024

`using System;
using Raven.Client.Documents.Indexes;
using System.Linq;
using Raven.TestDriver;
using Xunit;
using Raven.Client.Documents;
namespace Fields.Tests.RavenDB
{
public class CoraxMultipleOrderBy : RavenTestDriver
{
[Fact]
public void CoraxMultipleOrder_SearchEngine_Test()
{

        var store = GetDocumentStore();

        store.ExecuteIndex(new OrderByIndexLucene());
        store.ExecuteIndex(new OrderByIndexCorax());

        using (var session = store.OpenSession())
        {
            for (int i = 0; i < 100; i++)
            {
                session.Store(new TestDocument
                {
                    Name = "Name_" + i.ToString(),
                    DateCreated = new DateTime(2000, 1, 1).AddDays(i),
                    Archived = i % 2 == 0
                });
            }

            session.SaveChanges();
        }

        WaitForIndexing(store);

        using (var session = store.OpenSession())
        {
            var luceneDocs = session.Query<TestDocument, OrderByIndexLucene>()
                .OrderBy(x => x.Archived).ThenByDescending(x => x.DateCreated).Skip(10).Take(10)
                .ToList();

            var coraxDocs = session.Query<TestDocument, OrderByIndexCorax>()
                .OrderBy(x => x.Archived).ThenByDescending(x => x.DateCreated).Skip(10).Take(10)
                .ToList();

            Assert.Equal(luceneDocs, coraxDocs);

        }

    }

    private class OrderByIndexLucene : AbstractIndexCreationTask<TestDocument>
    {

        public OrderByIndexLucene()
        {
            SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Lucene;

            Map = entities => from entity in entities
                              select new
                              {
                                  entity.Id,
                                  entity.Name,
                                  entity.Archived,
                                  entity.DateCreated
                              };

        }
    }

    private class OrderByIndexCorax : AbstractIndexCreationTask<TestDocument>
    {

        public OrderByIndexCorax()
        {
            SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Corax;

            Map = entities => from entity in entities
                              select new
                              {
                                  entity.Id,
                                  entity.Name,
                                  entity.Archived,
                                  entity.DateCreated
                              };

        }
    }

    public class TestDocument
    {
        public string Id { get; set; } = null!;
        public bool Archived { get; set; }
        public DateTime DateCreated { get; set; }
        public string Name { get; set; } = null!;
    }


}

}`

from ravendb.

KresoJ avatar KresoJ commented on June 18, 2024

`using System;
using Raven.Client.Documents.Indexes;
using System.Linq;
using Raven.TestDriver;
using Xunit;
using Raven.Client.Documents;
namespace Fields.Tests.RavenDB
{
public class CoraxMultipleOrderByDuplicates : RavenTestDriver
{
[Fact]
public void CoraxMultipleOrder_SearchEngine_Test2()
{

        var store = GetDocumentStore();

        store.ExecuteIndex(new OrderByIndexCorax());

        using (var session = store.OpenSession())
        {
            for (int i = 0; i < 100; i++)
            {
                session.Store(new TestDocument
                {
                    Name = "Name_" + i.ToString(),
                    DateCreated = new DateTime(2000, 1, 1).AddDays(i),
                    Archived = i % 2 == 0
                });
            }

            session.SaveChanges();
        }

        WaitForIndexing(store);

        using (var session = store.OpenSession())
        {

            var page1 = session.Query<TestDocument, OrderByIndexCorax>()
                .OrderBy(x => x.Archived).ThenByDescending(x => x.DateCreated).Skip(0).Take(10)
                .ToList();

            var page2 = session.Query<TestDocument, OrderByIndexCorax>()
                .OrderBy(x => x.Archived).ThenByDescending(x => x.DateCreated).Skip(10).Take(10)
                .ToList();

            Assert.NotEqual(page1.First().Id, page2.First().Id);

        }

    }


    private class OrderByIndexCorax : AbstractIndexCreationTask<TestDocument>
    {

        public OrderByIndexCorax()
        {
            SearchEngineType = Raven.Client.Documents.Indexes.SearchEngineType.Corax;

            Map = entities => from entity in entities
                              select new
                              {
                                  entity.Id,
                                  entity.Name,
                                  entity.Archived,
                                  entity.DateCreated
                              };

        }
    }

    public class TestDocument
    {
        public string Id { get; set; } = null!;
        public bool Archived { get; set; }
        public DateTime DateCreated { get; set; }
        public string Name { get; set; } = null!;
    }


}

}`

from ravendb.

KresoJ avatar KresoJ commented on June 18, 2024

Hi @arekpalinski,
the first test compares lucene and corax for the same data, and the second one detects the same document on different pages with corax engine.

from ravendb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.