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).
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...
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)
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.
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 testet 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.
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.
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...
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)
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.
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:
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.
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
is working on a reply...