November Happy Hour will be moved to Thursday December 5th.

Unified Search - Getting search hits on parts of name space of model

Vote:
 
var query = SearchClient.Instance
                .UnifiedSearchFor(queryString)
                .WildcardFor(string.Format("*{0}*", queryString))

    

On my Unified Search page I'm getting search hits on fields in the index I don't want to search in.

 

Search examples and result:

"Model" -> Result is all the pages and files in the solution

"ArticlePage" -> Result is all pages of type ArticlePage

 

I'm guessing it has to do with these (or similar) values in the Index:

"$type": "Kirken.Models.Pages.ArticlePage, Kirken"
"_TypeShortName": "ArticlePage",

 

The text "Model" and "ArticlePage" is not written on any page or in any file, so I sholdn't get any hits searching for them.

#80907
Feb 04, 2014 17:38
Vote:
 

What's written in "WildCardFor"? This would typically happend if you have not specified .InField(...) values if you have another .For(..) in your WildCardFor method.


#80922
Feb 05, 2014 8:38
Vote:
 

I found my WildCard method here: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=72508

 

public static IQueriedSearch<TSource, QueryStringQuery> WildcardFor<TSource>(this ITypeSearch<TSource> search, string queryString)
        {
            return new Search<TSource, QueryStringQuery>(search, context =>
            {
                var query = new QueryStringQuery(queryString); context.RequestBody.Query = query;
            });
        }

    

#80926
Feb 05, 2014 9:26
Vote:
 

If you read the first post in that thread, the goal is to search in all fields. In your case, you need to limit the wildcard search to certain fields. Here is an example on how to do just that:
http://joelabrahamsson.com/wildcard-queries-with-episerver-find/

#80927
Edited, Feb 05, 2014 9:32
Vote:
 

Ah.

That makes sense. Thanks.

#81108
Feb 10, 2014 14:16
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.