I'm currently trying to implement some custom examine indexing/searching. For this I have multiple index sets in which different entities are indexed. Some of these entities are related to each other. The relation is implemented with foreign ids. So for example Location -> Adress is related by Location.AddressId.
Is there a way to implement a custom searcher which can relate both index sets during searching or do I have to implement my searcher to first search my locations and then search my addresses and after that merge everything together manually?
As far as I know you can't combine indexes in searchers as you expect. There are in lucene ways to "Join", but I don't think they are supported in the current version which is provided with umbraco.
not really a fan of this approach. I'm indexing custom stuff and with this I would have a lot of empty fields which are special for each of the types I'm indexing. Not really good practice I think.
Think I'm indeed on the wrong track of what I try to achieve.
Maybe it is in fact the right thing to denormalise the data and add every searchable field to the index even if it originally comes from a related object.
As the index is just for finding the stuff and showing them in the search results.
I will think about it a bit.
But thanks for the hints and suggestions Ismail and Damiaan!
Common mistake, we have to think about sql structured normalised tables etc differently from search indexes which are flat they are different beasts altogether.
Combine examine indexes
Hi everyone,
I'm currently trying to implement some custom examine indexing/searching. For this I have multiple index sets in which different entities are indexed. Some of these entities are related to each other. The relation is implemented with foreign ids. So for example Location -> Adress is related by Location.AddressId.
Is there a way to implement a custom searcher which can relate both index sets during searching or do I have to implement my searcher to first search my locations and then search my addresses and after that merge everything together manually?
Hope somebody has an idea.
Regards David
As far as I know you can't combine indexes in searchers as you expect. There are in lucene ways to "Join", but I don't think they are supported in the current version which is provided with umbraco.
Hi Damiaan,
thanks for the hint. I will look at lucene. But I also think that the version is probaply not used in umbraco.
Regards David
Why not merging the 2 merge at index time and add a "TYPE" field? then you can do a search and know which document type you get back...
Hi Damiaan,
not really a fan of this approach. I'm indexing custom stuff and with this I would have a lot of empty fields which are special for each of the types I'm indexing. Not really good practice I think.
Regards David
I guess that this is not a problem. I've tweeted to Ismail. :-) Hope he can share some insights.
David,
You can search multiple indexes however you cannot do a sql type join as its not a relational database.
You could in theory build a third index which contains denormalised data that has all fields you want to search on and display.
Regards
Ismail
Hi Ismail,
thanks for the insights.
Think I'm indeed on the wrong track of what I try to achieve. Maybe it is in fact the right thing to denormalise the data and add every searchable field to the index even if it originally comes from a related object.
As the index is just for finding the stuff and showing them in the search results.
I will think about it a bit.
But thanks for the hints and suggestions Ismail and Damiaan!
Regards David
David,
Common mistake, we have to think about sql structured normalised tables etc differently from search indexes which are flat they are different beasts altogether.
Regards
Ismail
is working on a reply...