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
Extend RavenDb Faceted Search (GetFacet)
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
  12 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
 
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 3:43 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 12:43:50 -0700 (PDT)
Local: Mon, Apr 23 2012 3:43 pm
Subject: Extend RavenDb Faceted Search (GetFacet)

Hi, I need to add custom code around line 74 of the FacetedQueryRunner,
see:
https://github.com/ravendb/ravendb/blob/master/Raven.Database/Queries...
.

How to get started? Is that manageable through bundles or plugins?


 
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.
Itamar Syn-Hershko  
View profile  
 More options Apr 23 2012, 4:13 pm
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Mon, 23 Apr 2012 23:13:56 +0300
Local: Mon, Apr 23 2012 4:13 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

Doing what?

We will accept pull request if it will make sense

On Mon, Apr 23, 2012 at 10:43 PM, Maxime Beaudoin <beaudoin.max...@gmail.com


 
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.
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 4:27 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 13:27:01 -0700 (PDT)
Local: Mon, Apr 23 2012 4:27 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

Well, actually I might be mistaken on the exact line and file but the idea
is to extend RavenDb in order to support a hierarchical taxonomy or
hierarchical facets and values.

See this resource for a concrete example:
http://wiki.apache.org/solr/HierarchicalFaceting
I'm calling this an advanced scenario but it's pretty much basic nowadays.

First, I'd like to be able to replicate that specific scenario. Basically,
Raven should allow some sort of extensibility in handling terms and facets
when faceting.

Maybe you can point me to the right direction?


 
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.
Itamar Syn-Hershko  
View profile  
 More options Apr 23 2012, 4:58 pm
From: Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
Date: Mon, 23 Apr 2012 23:58:12 +0300
Local: Mon, Apr 23 2012 4:58 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

It is absolutely doable, it's just a matter of figuring out the API and
actually implementing this. Note the indexing time processing that is
required - something needs to tell RavenDB to invoke this. And it needs to
make sense in the client API.

Take a look at the Facets responder and FacetQueryRunner on the server
side,  and the GetFacets method on the client side.

You need to think of how those hierarchies will be represented in your
object, and move from there

On Mon, Apr 23, 2012 at 11:27 PM, Maxime Beaudoin <beaudoin.max...@gmail.com


 
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.
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 5:12 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 14:12:12 -0700 (PDT)
Local: Mon, Apr 23 2012 5:12 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

I familiarized myself a little with the server side GetFacet; I tried to
re-implement the whole thing on the client side with an obvious issue: most
assemblies are server side.

Now, I understand that it's doable with a "Facet responder". However, only
triggers are documented on the official website, is that what you meant
when you said "figuring out the API" :)?

As for how to represent the hierarchies, they are mostly part of the
faceted values such as "fruit/banana" where "banana" is under "fruit".
Also, a fictional "HierarchicalPathAnalyzer" could probably compute the
paths for the client.

Here I go... Let me know if I'm wrong.


 
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.
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 5:53 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 14:53:26 -0700 (PDT)
Local: Mon, Apr 23 2012 5:53 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

It's been a long way since the stable release.. I can't use the Facets
responder as is. I can't say if I can do it without working on the trunk
which mean I would have to work on an unstable release arrg.


 
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 Apr 23 2012, 6:01 pm
From: Matt Warren <mattd...@gmail.com>
Date: Mon, 23 Apr 2012 15:01:04 -0700 (PDT)
Local: Mon, Apr 23 2012 6:01 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

RavenDB facets already allow you to specify a search parameter, I'm pretty
sure you just this to mimic the example you posted<http://wiki.apache.org/solr/HierarchicalFaceting>
?

If your index is something like this:
    from book in docs
    from category in book.Categories
    let levels = category.Split(new [] " > ")
    from level in levels
    //We want to convert "NonFic > Sci > Phys" into "2/NonFic/Sci/Phys"
    select new {
              Hierachy = levels.Count + "/" + category.Replace(" > ", "/"),
              LevelCount = levels.Count //Might also be useful to store the
count on it's own
              RawHierachy = category.Replace(" > ", "/")
           }

You can then do a basic query like this:
         var facetResults =
s.Query<T>("BookCatergories")                        
                        .ToFacets("facets/BookCatergories");

And a hierachial one like this (find all books with a cagetory below
"NonFic/Sci"
         var facetResults =
s.Query<T>("BookCatergories")                        
                        .Where(x => x.Hierachy.StartsWith("NonFic/Sci"))
                        .ToFacets("facets/BookCatergories");


 
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.
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 6:21 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 15:21:09 -0700 (PDT)
Local: Mon, Apr 23 2012 6:21 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

Hi Matt, thanks for replying.

It seems very flexible.. Somehow I just missed the .StartWith() part. Not
sure if it's because I told myself not to use that for some fictive
performance issues.

Anyway, here's my test:

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Raven.Abstractions.Data;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Indexes;
using Raven.Client.Linq;

namespace Prototype.Search.Tests
{
    [TestFixture]
    public class HierarchicalFaceting
    {
        //
        // Document definition
        //
        public class Doc
        {
            public Doc()
            {
                Categories = new List<string>();
            }

            public int Id { get; set; }
            public List<string> Categories { get; set; }
        }

        //
        // Data sample
        //
        public IEnumerable<Doc>  GetDocs()
        {
            yield return new Doc { Id = 1, Categories = new List<string> {
"0/NonFic", "1/NonFic/Law"} };
            yield return new Doc { Id = 2, Categories = new List<string> {
"0/NonFic", "1/NonFic/Sci" } };
            yield return new Doc { Id = 3, Categories = new List<string> {
"0/NonFic", "1/NonFic/Hist", "1/NonFic/Sci", "2/NonFic/Sci/Phys" } };
        }

        //
        // The index
        //
        public class DocByCategory : AbstractIndexCreationTask<Doc,
DocByCategory.ReduceResult>
        {
            public class ReduceResult
            {
                public string Category { get; set; }
            }

            public DocByCategory()
            {
                Map = docs =>
                      from d in docs
                      from c in d.Categories
                      select new
                                 {
                                     Category = c
                                 };
            }
        }

        //
        // FacetSetup
        //
        public FacetSetup GetDocFacetSetup()
        {
            return new FacetSetup
                       {
                           Id = "facets/Doc",
                           Facets = new List<Facet>
                                        {
                                            new Facet
                                                {
                                                    Name = "Category"
                                                }
                                        }
                       };
        }

        [SetUp]
        public void SetupDb()
        {
            IDocumentStore store = new DocumentStore()
            {
                Url = "http://localhost:8080"
            };
            store.Initialize();

IndexCreation.CreateIndexes(typeof(HierarchicalFaceting).Assembly, store);

            var session = store.OpenSession();
            session.Store(GetDocFacetSetup());
            session.SaveChanges();

            store.Dispose();
        }

        [Test]
        [Ignore]
        public void DeleteAll()
        {
            IDocumentStore store = new DocumentStore()
            {
                Url = "http://localhost:8080"
            };
            store.Initialize();

            store.DatabaseCommands.DeleteIndex("Raven/DocByCategory");

store.DatabaseCommands.DeleteByIndex("Raven/DocumentsByEntityName", new
IndexQuery());

            store.Dispose();
        }

        [Test]
        [Ignore]
        public void StoreDocs()
        {
            IDocumentStore store = new DocumentStore()
            {
                Url = "http://localhost:8080"
            };
            store.Initialize();

            var session = store.OpenSession();

            foreach (var doc in GetDocs())
            {
                session.Store(doc);
            }

            session.SaveChanges();
            session.Dispose();
            store.Dispose();
        }

        [Test]
        public void QueryDocsByCategory()
        {
            IDocumentStore store = new DocumentStore()
            {
                Url = "http://localhost:8080"
            };
            store.Initialize();

            var session = store.OpenSession();

            var q = session.Query<DocByCategory.ReduceResult,
DocByCategory>()
                .Where(d => d.Category == "1/NonFic/Sci")
                .As<Doc>();

            var results = q.ToList();
            var facetResults = q.ToFacets("facets/Doc").ToList();

            session.Dispose();
            store.Dispose();
        }

        [Test]
        public void GetFacets()
        {
            IDocumentStore store = new DocumentStore()
            {
                Url = "http://localhost:8080"
            };
            store.Initialize();

            var session = store.OpenSession();

            var q = session.Query<DocByCategory.ReduceResult,
DocByCategory>()
                .Where(d => d.Category.StartsWith("1/NonFic"))
                .As<Doc>();

            var results = q.ToList();
            var facetResults = q.ToFacets("facets/Doc").ToList();

            session.Dispose();
            store.Dispose();
        }
    }


 
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.
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 6:22 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 15:22:34 -0700 (PDT)
Local: Mon, Apr 23 2012 6:22 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

I'm still unsure why they used a Depth.. It seems to make no real
difference.

...

read more »


 
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 Apr 23 2012, 6:31 pm
From: Matt Warren <mattd...@gmail.com>
Date: Mon, 23 Apr 2012 15:31:32 -0700 (PDT)
Local: Mon, Apr 23 2012 6:31 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

Does that test give you the facet results you expect?

> I'm still unsure why they used a Depth.. It seems to make no real

difference.
I think it's there if you want to limit the depth it can be found at. But
you're right I'm not sure what actual scenarios it would be useful because
you're already specifying the prefix.

...

read more »


 
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 Apr 23 2012, 6:34 pm
From: Matt Warren <mattd...@gmail.com>
Date: Mon, 23 Apr 2012 15:34:12 -0700 (PDT)
Local: Mon, Apr 23 2012 6:34 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

> It seems very flexible.. Somehow I just missed the .StartWith() part. Not

sure if it's because I told myself not > to use that for some fictive
performance issues.

Well in Lucene StartsWith queries are okay, it's EndsWith ones that have a
perf issue.

So "matt*" is okay, but "*tthew" could be slow

...

read more »


 
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.
Maxime Beaudoin  
View profile  
 More options Apr 23 2012, 8:30 pm
From: Maxime Beaudoin <beaudoin.max...@gmail.com>
Date: Mon, 23 Apr 2012 17:30:27 -0700 (PDT)
Local: Mon, Apr 23 2012 8:30 pm
Subject: Re: [RavenDB] Extend RavenDb Faceted Search (GetFacet)

So far yes, thank you! :)

...

read more »


 
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 »