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?
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))?
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?
Yeah, just to get a realistic comparison
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 Index
Hittade 1 dokument
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.
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" %>
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <div> <h1>EpiFind-test</h1> FileSearch:<br/> <% var result = SearchClient.Instance.Search<UnifiedFile>().For("modifying").GetFilesResult(); Response.Write("ResultCount: " + result.TotalMatching); %> <br/><br/><br/> UniFiedSearch:<br/> <% var searchResult3 = SearchClient.Instance.UnifiedSearchFor("modifying").GetResult(); Response.Write("ResultCount: " + searchResult3.TotalMatching); %> <br/><br/><br/> UniFiedSearch ALL:<br/> <% var searchResult4 = SearchClient.Instance.UnifiedSearchFor("").GetResult(); Response.Write("ResultCount: " + searchResult4.TotalMatching); %> </div></body></html>
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?
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...../Henrik
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.
Thanks Marcus, I was thinking in that direction so now it's time for some digging to see what it does
Yes reflecting might be the easiest way to find out