Using indexed properties bundles

122 views
Skip to first unread message

Jason Dentler

unread,
Sep 1, 2012, 3:16:25 AM9/1/12
to rav...@googlegroups.com
Hi,

I couldn't find any documentation, but I think this bundle does what I need.

I have 3 types of documents: communities, floor plans, and model homes. FloorPlans and ModelHomes both have a Price and a CommunityId property. I need to display "Homes starting at $222,900" on the community's page and in a lot of community search results.

I have an index to get the minimum price per community. I think this bundle will automatically keep my community doc's MinimumPrice property accurate. How do I configure the bundle to make that magic happen?

- J

Oren Eini (Ayende Rahien)

unread,
Sep 1, 2012, 7:05:07 AM9/1/12
to rav...@googlegroups.com
The best "docs" are here:

We are working on that.

Note that for what you need, I don't see why you would need this.
Can you explain a bit more why you want to put it in the community doc?
What sort of searches are we talking about?

Let us assume that you have the following index:

communities/MinPrice

from h in docs.Homes
select new { h.CommunityId, MinPrice = h.Price } 


from result in results
group result by result.CommunityId into g
select new { CommunityId = g.Key, MinPrice = g.Min(x=>x.MinPrice) }


You would then create the following document:

Raven/IndexedProperties/communities/MinPrice 
{
  "DocumentKey" : "CommunityId",
  "FieldNameMappings": {
          "MinPrice" : "CommunityMinimumPrice"

Jason Dentler

unread,
Sep 1, 2012, 11:22:29 AM9/1/12
to rav...@googlegroups.com
Thanks Oren! That's exactly what I need. The indexed property bundle lets me get this base price calculation out of the way of our already-complex search requirements.

There are simple community lists all over the site, but those aren't a concern. We have one "Find a home" page where the criteria can really get out of hand. An example might be "Show me homes in Northwest Houston under $310,000 with at least 4 bedrooms and a 2 car garage, with a golf course and pool nearby"

The city, part of town, and nearby amenities are stored in the community doc and the rest is in the floor plan docs.

The displayed results would be something like this:

Bridgeland, from the $240s, 2500-5000 sq ft.
 - The Beezer, from the $260s, 2600 sq ft, 4 bedrooms, 2.5 baths, 2 car garage
 - The Barker, from the $300s, 3300 sq ft, 4 bedrooms, 3 baths, 2 car garage
The Cove, from the $190s, 2400-3400 sq ft
 - The Bellville, from the $200s, 2600 sq ft, 4 bedrooms, 2 baths, 2 car garage

I expect the actual results from Raven will be some flat composite of community & floor plan data sorted by community. We'll do the grouping as we loop through the result.

We're not sure if this one complex search page is something we should even be doing with Raven. We're also considering doing the more complex filtering in memory, or replicating to SQL server and querying there. We haven't tried any of it yet, but if you've got ideas...

- J

Oren Eini (Ayende Rahien)

unread,
Sep 1, 2012, 11:25:47 AM9/1/12
to rav...@googlegroups.com
What is the query you are issuing?
You shown the results, but not the actual query

Jason Dentler

unread,
Sep 2, 2012, 8:56:39 AM9/2/12
to rav...@googlegroups.com
Oren,

We haven't built that query yet. We're still prototyping & evaluating if RavenDB is the right choice for this project. 

An typical search might be "Show me homes in Northwest Houston under $310,000 with at least 4 bedrooms and a 2 car garage, with a golf course and pool nearby"

- J

Oren Eini (Ayende Rahien)

unread,
Sep 2, 2012, 9:01:15 AM9/2/12
to rav...@googlegroups.com
Show me homes in Northwest Houston under $310,000 with at least 4 bedrooms and a 2 car garage, with a golf course and pool nearby 

The yellow things are data that belongs to the house, right?
And the green to the community?

Jason Dentler

unread,
Sep 2, 2012, 9:22:47 AM9/2/12
to rav...@googlegroups.com
You got it.

By the way, the indexed properties bundle disappeared from your 1.2 branch. Why?

- J

Jason Dentler

unread,
Sep 2, 2012, 10:08:08 AM9/2/12
to rav...@googlegroups.com
Just to clarify, the user is required to search within a market (Houston, in this example). The other search criteria are optional.

- J

Kijana Woodard

unread,
Sep 2, 2012, 11:31:52 AM9/2/12
to rav...@googlegroups.com

Hmmmm. I wonder if Facets may be of value to you.

Oren Eini (Ayende Rahien)

unread,
Sep 2, 2012, 2:01:04 PM9/2/12
to rav...@googlegroups.com
Yes, that was what I was thinking.
You probably want to start with a search to get the market.
Then, you search for homes in that market, and provide the user with facets for them.
Reply all
Reply to author
Forward
0 new messages