Tuesday, July 19, 2011

Released: SharePoint Search Parts

The past couple of weeks I’ve been working evenings and some during the day when my kid is asleep on a FQL (FAST Query Language) enabled Core Results web part. The reason for going fql is not to write it directly into the search box, but in order to provide proper synonym and wildcard support. (Note: fql is only supported with FAST for SharePoint)

imageThe project can be found at http://spsearchparts.codeplex.com/ and is currently in alpha. It might actually be higher quality than what you expect from an alpha version, but I haven’t had time to test it properly.

The biggest undertaking in the project was to write a kql->fql parser. I think the parser works ok at the moment, but there is always room for improvement, and I might have missed something.

The other technical challenge was to enable fql support in the web part. Thankfully, Ivan Neganov has a blog post on how to do this which  I used as foundation for the web part. I did however change the use of direct reflection to use IL.Emit, as it’s more performant and can be cached, but it’s still reflection ;-)

Synonyms are expanded based on single words or phrases. If you add a synonym in SharePoint with two or more words, it will only match in “search phrases” with quotes. I might change this to match multiple terms as well. Synonyms are also lemmatized/stemmed, which they are not in the standard web part.

There is also an option to boost the original query words over the synonyms which could be useful. At least it was fun to implement :-)

Wildcards are supported like they are in fql, where both ? and * can be used, and also anywhere in the words.

When using the web part you can use my query tool at http://fs4splogger.codeplex.com/ to inspect how the kql query is transformed into fql. This will also show synonym expansion and added scopes.

I plan to add more search parts as I have time, and hopefully the project can grow into something really useful.

More information can be found at the project page.