Tuesday, 9 December 2014

Sharepoint 2010 FAST Search: Fast Query Language lessons learned

I am currently experiencing the joys of writing FQL search queries. It has been pretty much smooth sailing after I added my Managed Properties (with this script) and using these references:


However, I learned the following lessons (the hard way):

1. using 'Path' to filter by URL did not work for me. I had to use

2. date range queries work much better when dates are set in UTC
myDateField:range(2000-01-01T00:00:00Z, 2020-01-01T00:00:00Z)

SharePoint 2010 FAST Search: How do I create Managed Properties?

I have delving into the wonders of FAST Search and found this very helpful script to create managed properties.

It definitely saved my a lot of time and headaches. Thank you Ivan Josipovic.

Here is a copied version of the text:

function New-FASTManagedProperty([string]$Name, [string]$CrawledPropertyName, [string]$Type,[bool]$Refinement,$Sortable)
if ( (Get-PSSnapin -Name Microsoft.FASTSearch.PowerShell -ErrorAction SilentlyContinue) -eq $null )
 Add-PsSnapin Microsoft.FASTSearch.PowerShell

    switch ($Type)
        "Text" {$type = "1"}  #variant 31
        "Integer" {$type = "2"} #variant 3
        "Decimal" {$type = "5"} #variant 5
        "DateTime" {$type = "6"} #variant 64
        "Float" {$type = "4"} #variant 5 ?
        "Binary" {$type = "3"}  #variant 11
    $managedproperty = Get-FASTSearchMetadataManagedProperty –Name $Name
    if ($managedproperty -eq $null){
        New-FASTSearchMetadataManagedProperty -Name $Name -Type $Type -ea 0
        $managedproperty = Get-FASTSearchMetadataManagedProperty –Name $Name

    Set-FASTSearchMetadataManagedProperty –Name $Name –Queryable $true –StemmingEnabled $false –RefinementEnabled  $Refinement -SortableType $Sortable

    $cp = Get-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName
        if ($cp -eq $null){
                "1" {$variant = "31"}  #Text 31
                "2" {$variant = "3"} #Integer 3
                "5" {$variant = "4"} #Decimal 5
                "6" {$variant = "64"} #DateTime 64
                "4" {$variant = "5"} #Float 5 ?
                "3" {$variant = "11"}  #Binary 11
            New-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName -Propset "00130329-0000-0130-c000-000000131346" -VariantType $variant
            $cp = Get-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName
            write-host "Created $($CrawledPropertyName) Crawled Property"

$property = Get-FASTSearchMetadataCrawledPropertyMapping -name $Name

if ($property -ne $null)
Remove-FASTSearchMetadataCrawledPropertyMapping –managedproperty $managedproperty -crawledproperty $cp -force

        New-FASTSearchMetadataCrawledPropertyMapping –Managedproperty $managedproperty –crawledproperty $cp -ea 0
    write-host "Created $($Name)"

It can be invoked as follows:

New-FASTManagedProperty "ListItemID" "ows_id" "Integer" $true "1"  

Monday, 1 December 2014

Cntlm: No connection could be made because the target machine actively refused it

Cntlm is a great tool to create an internet proxy. I wrote about how to configure it here.  However, I recently encountered the following error message when trying to access a local REST service:

No connection could be made because the target machine actively refused it

The port number rang a mental bell as it was configured as the listening port for Cntlm. I deactivated Cntlm:

1. Stopped the windows service
2. Reverted the proxy settings in my browser

No luck.

I tried rebooting the server, but that did not resolve the problem.

More investigation revealed that Application Pool account for my custom web site was caching the Cntlm connection. I connected to the machine as the Application Pool account and noticed that the proxy settings for cntlm where still there. I was able to reset the settings to resolve the problem.

Alternatively, I could change the Application Pool account.