Copied to clipboard

Flag this post as spam?

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


  • Paul Griffiths 370 posts 1021 karma points
    Mar 17, 2016 @ 08:32
    Paul Griffiths
    0

    Hi,

    I’m really struggling to get my head around this whole search functionality in Umbraco and seriously on the verge of giving up with this custom property (houses) search I’m trying to develop. I’m wondering if anyone has developed something similar or if anyone can point me in the right direction of what I need to read/do to implement this. I am trying to use ezSearch as a base for what I am trying to do (unsure if this will work)

    What I already have

    I have built the following form which allows the user to select their preference to filter the search results by

    enter image description here

    When I submit the form I am able to successfully pass all the values (using query string parameters in the URL) to a search results page I have created in umbraco

    http://localhost/search/?lat=99999999&lng=66666666&searchType=toBuy&location=london&minBuyPrice=80000&maxBuyPrice=160000&minRentPrice=0&maxRentPrice=0&minBedrooms=3&maxBedrooms=0&propertyType=house
    

    On the search results page I have placed the eZSearch macro and specified all the umbraco properties that I would like to search against e.g.

    • propertyCategory • googleMapLocation • propertyAddress • propertyPrice • numberOfBedrooms • propertyType

    What I am really struggling with, is the logic in the ezSearch to be able to filter properties based on the parameters that have been passed in. How do I check against each property (created in umbraco as a node with a doctype alias of propertyListing) on each propertyListing to establish whether we have a match?

    I am able to get all the form values into the ezSearch macro partial by creating new properties on the searchViewModel that already exists but I am struggling to do the filtering based on what has been passed.

        //custom property params
        SearchType = CleanseSearchTerm(("" + Request["searchType"]).ToLower(CultureInfo.InvariantCulture)),
        Location = CleanseSearchTerm(("" + Request["location"]).ToLower(CultureInfo.InvariantCulture)),
        Latitude = CleanseSearchTerm(("" + Request["lat"]).ToLower(CultureInfo.InvariantCulture)),
        Logitiude = CleanseSearchTerm(("" + Request["lng"]).ToLower(CultureInfo.InvariantCulture)),
        MinBuyPrice = CleanseSearchTerm(("" + Request["minBuyPrice"]).ToLower(CultureInfo.InvariantCulture)),
        MaxBuyPrice = CleanseSearchTerm(("" + Request["maxBuyPrice"]).ToLower(CultureInfo.InvariantCulture)),
        MinRentPrice = CleanseSearchTerm(("" + Request["minRentPrice"]).ToLower(CultureInfo.InvariantCulture)),
        MaxRentPrice = CleanseSearchTerm(("" + Request["maxRentPrice"]).ToLower(CultureInfo.InvariantCulture)),
        MinBedrooms = CleanseSearchTerm(("" + Request["minBedrooms"]).ToLower(CultureInfo.InvariantCulture)),
        MaxBedrooms = CleanseSearchTerm(("" + Request["maxBedrooms"]).ToLower(CultureInfo.InvariantCulture)),
        PropertyType = CleanseSearchTerm(("" + Request["propertyType"]).ToLower(CultureInfo.InvariantCulture)),
    

    If there is someone who can point me in the right direction I would be seriously grateful, Id love to get this implemented but as it stands I’m close to giving up altogether. Its been a whole week of struggling lol.

    Thanks

    Paul

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Mar 17, 2016 @ 08:47
    Ismail Mayat
    0

    Paul,

    You will need to massage the data into the index using gatheringnode data event will require some coding. I did something similar although not property search see http://www.thefabricofindustry.com/

    There was uhangout session about it see http://uhangout.co.uk/videos/ep006-with-ismail-mayat-a-walkthrough-of-a-site-powered-by-examine-searches/

    With regards to the longitude and latitude are you trying todo a range search within that area? If so you won't be able to do that with examine directly but you can do it with lucene spatial see https://www.leapinggorilla.com/Blog/Read/1010/spatial-search-in-lucenenet---worked-example

    There is a bit of coding involved to get this up and running.

    Regards

    Ismail

  • Paul Griffiths 370 posts 1021 karma points
    Mar 17, 2016 @ 10:32
    Paul Griffiths
    0

    Hi Ismail,

    Really appreciate your response and information. By the sounds of it this could be quite a hefty piece to try and implement.

    Funny enough I believe I have already stumbled across your videos on uHangout but I will certainly revisit these and have another attempt at getting this to work. At least i now know that this is what i need to understand in order to get this working.

    I have never really used examine so I think I am going to need to invest some time getting up to speed. Hopefully revisiting your videos will help me move forward with this one.

    I guess I was kindling of hoping for an easier way out and hoping I could build upon what’s available on ezSearch :(

    Thanks mate Paul

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Mar 17, 2016 @ 13:35
    Ismail Mayat
    0

    Paul,

    No it will require some work. ezSearch gives you basic full text search. If you want to do range searches particularly with numerics and dates you need to massage the data into the index. There are quite a few posts on our by me just do search for examine range search or examine range query.

    The spatial stuff I have not done but know how to do it also on our there are some posts by me helping some people who have actually done it.

    Also worth watching session i did at uk festival 2012 https://www.youtube.com/watch?v=6AMb0rrSrJw&feature=youtu.be

    Regards

    Ismail

  • Paul Griffiths 370 posts 1021 karma points
    Mar 17, 2016 @ 18:25
    Paul Griffiths
    0

    Hi Ismail,

    Thanks for the links 😄. I watched the two videos on the way home and it seems like some complicated stuff for a examine novice like myself.

    I thinking before I can even contemplate working with things such as gathering node data etc. I need to understand the fundamentals of examine and what it's all about.

    I need to start at the very beginning, what would you recommend?

    The search u built with all the products looks like a beast ha

    Many thanks

    Paul

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Mar 18, 2016 @ 09:30
    Ismail Mayat
    0

    Paul,

    I did series of blog posts see http://thecogworks.co.uk/blog/2012/11/05/examiness-hints-and-tips-from-the-trenches-part-1-umbraco-examine

    follow those to get you up to speed. I also put together a workshop with set of excercies we are planning on running another one not sure when though.

    It was based on those blog posts so you get umbraco starter kit site then using visual studio you build up a search.

    Regards

    Ismail

  • Paul Griffiths 370 posts 1021 karma points
    Mar 18, 2016 @ 11:08
    Paul Griffiths
    0

    Hi Ismail,

    Awesome, thanks for the blog link; I was searching for it last night after you mention it in the video I watched. I ended up reading a blog post on the cog works about how you joined and then left there lol, good read!

    That’s exactly what I will do I will follow the workshop exercises and try to get up to speed with the basics rather than jumping in the deep end. What you put together sounds like it’s exactly what I need with using the starter kit and VS to build up a search. I have a perfect example for your next set of exercise..... It can be titled 'Develop a custom property search using examine' ;) ha.

    Thanks very much for your help regarding this.

    Many thanks

    Paul

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Mar 18, 2016 @ 11:34
    Ismail Mayat
    0

    Paul,

    Funny you should say that but i am currently working on something called ExamineContrib its a wrapper around lucene.net contrib so

    1. Spatial
    2. Spellchecker
    3. Similarity
    4. Highlighter
    5. Wordnet ?? - Maybe

    Basically get them to work with Examine, some of it might be a bit clunky but 1-4 I have working.

    So I will add 1 - 4 as excercises so the course and at some point release this library so others can use it.

    Regards

    Ismail

  • Paul Griffiths 370 posts 1021 karma points
    Mar 18, 2016 @ 11:51
    Paul Griffiths
    0

    Hi Ismail,

    Awesome, i shall look forward to working through these additional exercises.

    Ill be very interested in anything that is related which will aid my understanding and get me upto speed with all of this.

    Ill keep an eye out for additional info.

    Thanks again

    Paul

Please Sign in or register to post replies

Write your reply to:

Draft