The nature of my project is such that search is needed and specifically search across related entities. We want to perform several queries involving a correlation between two or more properties of a given entity in a collection.
To put things in context, take here is a snippet of the domain:
Code:
Artist { firstname, lastname, alias }
Album { title, releaseDate, genre }
House { address, city, state }
An artist can have many albums and houses. After indexing, I would like to be able to search for things like:
1) All atrists who released in 2010 in the genre of jazz
2) All atrist who live in new york, in the city of long island, who have released an album in 2011 with a genre of gospel
All my application cares about is returning "artist" entities at the end of every search.
One way to handle this will be to also index the collection entities (i.e.
Album and
House) and when a correlated like this comes in, for example in the case of 1), target album and then collect all the matching artists, but this quickly gets messy when I have more than one related child collections, e.g. 2).
It seems sub-optimal to perform several queries against child indexes, and then union the result to arrival at the final matching results. In our case, we have several of these child collections.
What is the best way to handle things like this? I looked into filters, but they don't address issues like this related to the query itself. It's more for cross-cutting concerns which is not what this is.
Is it even ideal to try to handle this with search? Or is the best thing to just do HSQL against the database?
Thanks.