How to join Apache Solr docs?

Events happening in the community are now at Drupal community events on www.drupal.org.
marashi's picture

I'm working on a hotel booking websites and I have two content-types which names are hotel and room and each room is a child of a specific hotel (I have made the relationship with Node Reference).
I have used Apache Solr to index and search the contents but because the rooms and hotels are separate content-types they will be index in separate documents (doc) in Apache Solr, so when I want to query something like "Show me hotels which have a room with less than $200 per night", it fails. because price is an attribute of room not hotel, but my search is based on hotels!

Is there a way to join these two docs (hotel and it's room childs) in apache solr?

Comments

Probably need to alter before indexing

milesw's picture

This is a great use case, something I'm sure others have/will run in to.

Have you tried Robert's ApacheSolr Nodereference Extras module yet? Sounds like it does what you're looking for. If not, you could use the same hooks from that module to modify documents before indexing and/or modify queries before they retrieve documents.

ApacheSolr Nodereference Extras

wmostrey's picture

ApacheSolr Nodereference Extras is indeed exactly what is needed here.

I have the same use case

reneve2010's picture

I have exactly the same use case:

Concept company (with name and description) has products (with name, description, price, and taxonomy terms). With ApacheSolr Nodereference Extras it's possible to combine the text fields of both concepts. However, it's not possible to combine the more important fields (price, taxonomy terms). In my case it would be really nice if it was possible. E.g.:

Company:
- Name: Microsoft
- description: Abc

Product 1:
- Name: Word
- Description: Abc
- Price: USD49,00
- Taxonomy Term: Office software

Product 2:
- Name: Dynamic CRM
- Description: Abc
- Price: USD249,00
- Taxonomy Term: CRM

Would result in:
Company:
- Name: Microsoft
- description: Abc
- Price: USD49,00
- Price: USD249,00
- Taxonomy Term: Office software
- Taxonomy Term: CRM

Or maybe with Facet Builder

gaëlg's picture

Apache Solr Facet Builder is in dev version too, and it allows you to create a facet which is a choice between view displays. Whith views relationships you may get what you want by creating several displays with different filters like "room price < $200", ""200 < room price < 400", etc.

Hi

jaykainthola's picture

I am getting the same issue. I tried with ApacheSolr Nodereference Extras but it did not work for me.

Kindly suggest how can we add nodereference cck fields to apachesolr indexing.

I too need facets for Terms

MickC's picture

I too need facets for Terms of node referenced entities in an Event search.
I also need Location search based on the location of the Venue, as the Event record does not have locations.

I believe Solr can do all this, and have facets for "joined" entities, but I fear this is going too far outside the Drupal module.

Worst case scenario is denormalising and adding Taxonomy and Locations to my Events, however this seems an inferior solution - duplications and performance issues. http://wiki.apache.org/solr/Join

You may have a look at this:

gaëlg's picture

You may have a look at this: http://drupal.org/node/776750

Lucene, Nutch and Solr

Group organizers

Group categories

Projects

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: