Star och empty-search with UnifiedSearch


We are using both standard .Search and .UnifiedSearch and when whe use .Search and pass in "*" or "" in "For" we get all results but when we do it in .UnifiedSearch we get no result. Do we pass in some text in .UnifiedSearch we get results so I woundering if there is not possible to do "star-search" with .UnifiedSearch?
Or am I doing it wrong?



Sep 20, 2013 11:10

Hey Henrik,

UnifiedSearch uses stemming in the language that you have provided, or in the users current language when using the CMS integration. Therefor, can you try and see what happens if you add a language when using the ordinary Search method (ie .Search<T>(Language.Swahili))?

Sep 23, 2013 14:56

Joel. I use the "dummy"-client for my search (var client = createfromconfig.,.) and I already set a language in my unifiedsearch but do you mean the other search where it works to search for star or empty string?

Sep 24, 2013 14:09

Yeah, just to get a realistic comparison

Sep 24, 2013 14:12

Something is strange with my unified search. I tried this as you said Joel:

var searchResult = client.Search<Jobbannons>(Language.Swedish).For("*").GetResult(); (Zero result)
var searchResult1 = client.Search<Jobbannons>(Language.Swedish).For("").GetResult(); (530 results)

I have four versioning files in my index and when I explore the index with a term inside the pdf I got this result:
Utforska IndexHelp

   Stödjer Lucene söksyntax


Knowing that I did four different simple Unified searches:

var searchResult = client.UnifiedSearchFor("*", Language.Swedish).GetResult();
var searchResult2 = client.UnifiedSearchFor("", Language.Swedish).GetResult();
var searchResult3 = client.UnifiedSearchFor("modifying", Language.Swedish).GetResult();
var searchResult4 = client.UnifiedSearchFor("modifying", Language.English).GetResult();

They ALL end up with zero result, the two last one searching for the same term as I did when I explored the index.



Sep 27, 2013 7:49

Ok, new info.

I tried to move the search-queries back to the web project and do the same test with the CMS-integration, buildning a extremly simple .aspx page like this:

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="EPiServer.Find" %>
<%@ Import Namespace="EPiServer.Find.Cms" %>
<%@ Import Namespace="EPiServer.Find.Framework" %>
<%@ Import Namespace="EPiServer.Web.Hosting" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">

var result = SearchClient.Instance.Search<UnifiedFile>().For("modifying").GetFilesResult();

Response.Write("ResultCount: " + result.TotalMatching);

var searchResult3 = SearchClient.Instance.UnifiedSearchFor("modifying").GetResult();
Response.Write("ResultCount: " + searchResult3.TotalMatching);

UniFiedSearch ALL:<br/>
var searchResult4 = SearchClient.Instance.UnifiedSearchFor("").GetResult();
Response.Write("ResultCount: " + searchResult4.TotalMatching);

To my supprise there it worked!

The result was 1 hit for the query with the text "modifying" both with unified search and with fileresult

And 15 hits for unified search with empty text.


I am not happy with that, since we do want to have the searching as a help class so what do the CMS integration do, that the client does not?



Sep 27, 2013 8:16

More detail:

SearchClient.Instance.UnifiedSearchFor("modifying", Language.Swedish).GetResult(); (One result)

var client = Client.CreateFromConfig();
client.UnifiedSearchFor("modifying", Language.Swedish).GetResult(); (No results)

So with the same language it's differ.....


Sep 27, 2013 8:27

That is most likely because you are using different clients. 

SearchClient.Instance have a lot of conventions that is set up on initialization for unifiedsearch(Part of the find.cms init). So you need to do similar setup in you client.

Sep 27, 2013 8:53

Thanks Marcus, I was thinking in that direction so now it's time for some digging to see what it does

Sep 27, 2013 8:56

Yes reflecting might be the easiest way to find out


Sep 27, 2013 9:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.