Hello Suresh
You should probably check out the BoostMatching capabilities of Find: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/75/DotNET-Client-API/Searching/Boosting-with-filters/
Hi David,
thanks !! that is a really good pointer for me.
I'm using BoostMatching () but it is showing an error on InField(x=>x.PageName). Could you help me with this ?
var query = SearchClient.Instance.Search<BasePage>(Language.Swedish).ForWithWildcards(Query)
.BoostMatching(x=>x.PageTypeName.Match("testpage"), 20)
.InField(x => x.PageName)
.AndInField(x => x.MainBody)
.BoostSummaryComments(10)
.AndInField(x => x.SearchText)
.InAllField()
.Track()
.Filter(ReadAccess_Filter)
.Filter(jpgFileTypeFilter)
.Filter(pngFileTypeFilter)
.Filter(gifFileTypeFilter)
.TermsFacetFor(x => x.SearchHitType, x => x.AllTerms = true);
Error :
The type 'EPiServer.Find.Api.Querying.Queries.CustomFiltersScoreQuery' cannot be used as type parameter 'TExistingQuery' in the generic type or method 'EPiServer.Find.QueryStringSearchExtensions.InField<TSource,TExistingQuery>(EPiServer.Find.IQueriedSearch<TSource,TExistingQuery>, System.Linq.Expressions.Expression<System.Func<TSource,string>>, double?)'. There is no implicit reference conversion from 'EPiServer.Find.Api.Querying.Queries.CustomFiltersScoreQuery' to 'EPiServer.Find.Api.Querying.Queries.QueryStringQuery'.
Hi!
Move the BoostMatching further down you query, below the InAllFiled should do it.
Also, you could use MatchType in your BoostMatching:
.BoostMatching(x => x.MatchType(typeof(TestPage)),2)
Hi Per,
thanks ! It works very well for me !!
now, I got some problem here. When I search for "erika" it shows "Hans erik", "Holmen erik".......
it seems it is taking only first 4 chars in search query text. Is there any way to change this ?
tack !
I guess that's the language stemming you're experiencing. You can remove the stemming effect by removing the langauge.
Hi,
I removed the stemming effect like this
var query = SearchClient.Instance.Search<BasePage>(Language.Swedish).ForWithWildcards(Query)
But I'm still getting results like "erik" when I search for "erika" .
Could you give any pointer on this ?
tack !
Not sure if I understand you correctly. Did you remove "Language.Swedish"? Here's some more information on stemming (at the bottom) : http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/8/DotNET-Client-API/Searching/Free-text-search/
Hi,
I have read link you suggested and tried removing stemming effect by specifing "Language.None". Still I'm getting "erik" for "erika".
That sounds odd. Could the "ForWithWildcards" have anything to do with it? What if you test by invoking "For" instead? Also, if you really do not need stemming, I suppose you do not need InFields and AndInField, since you are using the InAllField. This should also remove any stemming effects.
Hi again,
I used "For" and removed InFields, AndInField and InAllField, stil getting same results. I mean, getting "erik" for "erika".
var query = SearchClient.Instance.Search<BasePage>(Language.None).For(Query)
.Track()
.Filter(ReadAccess_Filter)
.Filter(jpgFileTypeFilter)
.Filter(pngFileTypeFilter)
.Filter(gifFileTypeFilter)
.TermsFacetFor(x => x.SearchHitType, x => x.AllTerms = true)
.OrderByDescending(x=>x.StartPublish);
Hi,
that sound very strange. It should not be possible! Are you doing a standard GetContentResult? Have you tried with different search queries? What if you go to the explore view in the EPiServer Find UI and search for "erika" there?
Hi,
It is really strange ! Yes, I'm using standard GetResult().
You can take a look into screenshots here...
http://i.imgur.com/BqUTrsv.png
http://i.imgur.com/cRSw8Wy.png
Looks like it is using stemming no matter what in your case. I see that you are on an older version - it might be a bug. Are you using the latest version of Find for cms 6?
It's a long shot, but there are no other properties on the pages with the value "erika", right? Do you get similar behavior if you search for "Henrika"?
Hi,
I'm using episerver Find 1 R2 ( compatible to episerver cms 6 r2 ).
When I search for "Henrika" it is showing "Henrik Gustavsson".
Maybe you should check with support. One more thing you could try is instead of specifying Language.None, you simply leave it blank. If that doesn't work you could try specifying a language that is not supported by your index, like Language.Galician (unless you actually have an index that supports that language). It's not pretty, but it just might do the trick
Hi Per,
Finally, it worked with Language.None and new index in epi find.
thanks !
Hi,
I'm using epi find for our search. In our search results, we have to show one specific page type first and then rest of the page types.
Is there any way to boost the score of page type ? I checked BestBets there you can only apply for a page not for entire page type.
Any help is appreciated !
thanks !