SharePoint Search word segmentation (WordBreaker)

【question】

We often search for a very long word, such as "International Cooperation Bank", and the corresponding search results will find anything related to "International", "Cooperation" and "Bank". Such behavior is a word segmentation, so how do you know How is the word segmentation in the search?

【Solution】

Use powershell to do it. E.g:

$query = "Bank for International Cooperation"
$ lcid = 1041
$ssa = Get-SPEnterpriseSearchServiceApplication -Identity "Search Service Application"
$queryInternal = New-Object Microsoft.Office.Server.Search.Query.KeywordQueryInternal($ssa)
$culture = New-Object "System.Globalization.CultureInfo" $lcid
$queryInternal.QueryProperties.Culture = $culture
$wordBreaker = $queryInternal.CreateWordBreaker($false)
$wordBreaker.BreakText($query)
foreach($tokens in $wordBreaker.GetTokens())
{
  foreach($token in $tokens)
  {
    Write-Host $query.Substring($token.SrcPos,$token.SrcLen)
  }
}

 

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326215174&siteId=291194637