Copied to clipboard

Flag this post as spam?

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


  • Thomas Charriere 3 posts 23 karma points
    Sep 20, 2010 @ 20:34
    Thomas Charriere
    0

    Examine Auto-Suggest/-Complete

    Hi guys! Does anyone have an example or an idea how to implement an auto-suggest/-complete for umbraco in combination with the Examine endpoint?

    I've set up all my indexes, - no problems there
    Searching over the index is a breeze
    But I can't seem to find anyway to return the "actual" hits into a List/Dictionary, (e.g. Query: tes, Hit: test).

    Thanks in advance.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 21, 2010 @ 00:15
    Aaron Powell
    0

    The "actual" hits are the results returned from the search. I don't see your problem, you've said you can search, which implies you've got the results...

  • Thomas Charriere 3 posts 23 karma points
    Sep 21, 2010 @ 09:21
    Thomas Charriere
    0

    A "classic" search implies that the entered query is searched for in the index and returns results. (A simple text field, onsubmit => search index => return results)

    An "autocomplete" search implies that queries are suggested to you, à la google: (text field, onkeydown (chars > 3) => "query" index => get near words (or tags maybe?) => return words => onsubmit => search index => return results)

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 21, 2010 @ 09:38
    Aaron Powell
    0

    There's nothing that you need to do specially with Examine for this, you're just performing a wildcard search. To do the autocomplete you can use the jQuery Autocompete plugin (http://docs.jquery.com/Plugins/autocomplete) which ships in Umbraco 4.5.x as it's used in the back office.

    You can submit to a HttpHandler, a web service, etc, perform the search using the Fluent API and wildcard the query that is entered.

  • Thomas Charriere 3 posts 23 karma points
    Sep 21, 2010 @ 10:11
    Thomas Charriere
    0

    I had a look at the QuickSearchHandler.ashx file on codeplex. The handler is perfect if you're only searching through one field, that also can be returned as the autocomplete value.

    For example: You type in "hom", and there appears "home (1064)" as the autocomplete value. => The term is only queried on the nodeName field in the index.

    "Content"-Nodes on the other-hand can contain several fields (e.g. title, bodyText, content, contentArea, abstract, headline, etc.) that can contain up to several hundred words. By querying the index (with the term "tes*") you receive the following entry:

     

    title Lorem ipsum
    content At vero eos et accusam et justo duo dolores test et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet

    First, you would need to find out which field the hit was in then, you would also need to find out what word was found in that field. There are some examples out the displaying how to do this with Lucene directly, but as Examine is "only" a layer on-top of Lucene it should also be possible.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 21, 2010 @ 10:30
    Aaron Powell
    0

    If you implement your own HttpHandler you can put your own logic behind it, there's plenty of examples on http://farmcode.org (search Examine). This is a good starting point: http://farmcode.org/post/2010/08/12/How-to-build-a-search-query-in-Examine.aspx

Please Sign in or register to post replies

Write your reply to:

Draft