Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Travis 19 posts 46 karma points
    Sep 16, 2010 @ 11:33
    Travis
    0

    Examine cross node searching

    Thanks for all the help so far guys!  Ismails information on GatheringNodeData was great, I thought I had things solved but I ran into a brick wall by the end of the day.

     

    We are trying to setup indexing to allow searching over 3 related node types. 

    The top level node is a Winery – it contains details like name, address, location, awards.

    Wine nodes contain – type (red, white etc), use by date, alcohol % etc. 

    Product nodes are what the winery actually sells – it may be a single bottle of wine or a 12 bottle pack of mixed wine. Products have things like price, pack size and the wines it contains as Umbraco 2 way Relations.

     

    Searching will be over the Winery, product and wine nodes.

     

    For example a user might search for  “good wines” winery, 12 bottle pack,  containing Red wine.

     

    Search results are always a list of products.

     

    The problem we have is that Lucene indexing doesn’t seem to have a way to link everything together and there doesn’t seem to be a way to have Examine relate the data.

    Each node type we index has no idea about the others so searching for “good wines” winery doesn’t return its products.  As we need complex searching this becomes a bit of an issue.

     

    Is there a join style function in Examine or some different method of setting up the index so it can relate all the required data together?   Do we need to do some radical custom indexing?

     

    Thanks for any help.  My ideas of how to solve this are getting too crazy to maintain down the track.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 16, 2010 @ 14:40
    Aaron Powell
    0

    If you're looking for a Join statement you're missing the point of a non-relational system ;).

    The only way which I can see you achieving what you want to achieve without doing a really custom indexer for Examine is to have multiple phase data retrieval. First you get back all the Winery nodes, then you find all the products which belong to the winery, and lastly each wine in each product.

    You could try the DocumentWriting event on the LuceneIndexer and then flatten the hierarchy down into a single record in Lucene but I'm not sure how it'll come back out of the searcher.

  • Travis 19 posts 46 karma points
    Sep 17, 2010 @ 03:39
    Travis
    0

    Thanks, that is what I was thinking.  I was crossing my fingers that there would be an easy solution.

    I think your last idea could work.  One solution I was considering was to compile the wine data and add them as fields to the products.  I should then be able to search on the "ContainsWineTypes" field for example.  I can't see why that wouldn't work.  

    I wanted to avoid a multi phase system but I guess searching the index is super quick and won't result in performance issues. I toyed about with custom indexing yesterday and both solutions seems well within reason.

    Thanks for your help, excellent as always.  When I build up some karma I will come back and give you a high five :)

     

     

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 17, 2010 @ 03:58
    Aaron Powell
    0

    Lucene does support the idea of pushing multiple terms into a single field, we just don't expose that in Examine (or at least it wont be available in v1, who knows about future releases).

    But since we expose an event just when the Lucene Document is being written to Lucene you can hook into there and do what you like. That is where you would flatten the hierarchy and through loops you'd push the stuff into the index as a single field.

    It's a highly specialized thing that you're trying to do which would mean that you have to do some edge-case stuff ;)

Please Sign in or register to post replies

Write your reply to:

Draft