Albert Jan Schot
 

Basic Search - Display Different Columns

31

Mar

So another minor post about search. Last post I explained the use of metadata property mappings, and their strength allowing you to show more information without a lot of changes. However I forgot to mention the fact that u can actually show them pretty easy in your existing search results.

Assuming you created your Metadata properties you can go to your search page, the XSLT of your resultswebpart to:

<?xml version="1.0" encoding="UTF-8"?>

      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

            <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

                  <xsl:template match="/">

                        <xmp><xsl:copy-of select="*"/></xmp>

                  </xsl:template>

</xsl:stylesheet>

(More info on that on a previous post on this blog) .

Next step will be a minor change in Results Query Options, here you will have a property for Selected Columns, editing it will show you the normal columns used in your search results before the end </Columns> you can easily add a new <Column Name=”YourMetaDataProperty” />. By using the above XLST you can save the page search, and check real-time whether your column exists and contains information.

You might have to play with capitalization a bit, ‘cause sometimes the column name differs from the metadata property.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

Basic Search - Metadata Property Mappings

31

Mar

As mentioned in the last post about Search, in the following posts there will be some more advanced features. In this post there will be some details about the your search properties (and using them in  your URL). While in the next post there will be some info about the Search Result Hidden Object, that allows you to sort your complete result set (and not only by the default relevance option).

Depending on how you use your SharePoint environments you can either choose for standard search WebParts (giving you only the options described in the previous post) or create your own webparts (described in the next post). Whatever option you may choose you will have to deal with showing information in you result set. Something that is easily obtained through the use of Metadata property mappings. This is a nice feature hidden in your SSP under search settings.  It contains a list of properties on your environment,  and the possibility to make a new one (making new ones allows you to map them to the BDC or other values existing on your environments).

Each item has a nice checkbox “Use in scopes” checking it will not only allow you to use this property to exclude/include items based on the property value but also allows it to be used in your URL.

Small example:

Most of you knows that passing the ?k=Test parameter to your search page will get a result set containing the keyword test. Passing the next url to your search page will not only get items containing the keyword test, but also match the Author : ?k=test+Author:”SystemAccount”

Each managed metadata property you create can be used within your URL to filter down search results (actually it’s how Faceted Search works).

Knowing that unleashes a lot of potential to your search solutions.

A small real live example:

You have a WebPart that gets items and folders. By searching in that WebPart you get redirected too your search page with a custom scope and you have the search results you want (easy doable with a k=<textbox value>&s=<set property>.

Now we would like to search not only the scope (that contains all items), but also we would like to search within a folder , the trick here is finding the metadata property containing the url (or folder in our case). Besides the fact that it took ages to find out what property it was, it’s pretty simple. The property seems to be Basic:9, so we made a new Metadata property and mapped it to Basic:9, that leaves us with a property containing the URL and all we had to do was to expand our k=<textbox value> with a +MetadataProppertyContainingBasic:9:”<the current folder>”. That actually returns only items of the folder where in.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

Faceted Search and 300 item limit

24

Mar

Before releasing the next post about search another small blog with a nice tip. As we use the Faceted Search in a few of our search solutions we found a small bug. If you have more than 300 search items, the facets ‘stop’ counting displaying a maximal calculated total of 300 items. So even if  your search says that the estimate is around +1000 results.

It made me wonder where it went wrong, so checking all settings I couldn’t find a 300 max in the properties of the facets. So there for I made a nice post on the Faceted Search Forms, where nvasave pointed me to the good direction.

Under Data Settings there is a property Select Columns for Facets, I had an value of 500 columns, changing that to 3000 displayed correct results for me (not that I know why it would display 300 items while getting 500 columns, but still it’s an solution).

And I am aware of the fact that in the 3.0 alpha version it is fixed, but you cannot always run alpha versions in production environments.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

Anonymous Acces & CQWP

23

Mar

So not much activity on my blog last days, due to some deadline stress. But like all deadlines they sometimes reveal some nice issues.  In our case we had a website containing some Content Query Webparts that rolled up some detail info. And then the fun started, a site has anonymous access. And as an example rolling up blog items gets you stuck @ copyutil.aspx, and clicking a url containing that page will present your anonymous users with a nice popup box asking them to log in. Not a very  nice user experience most of us agree on;

So  instead of writing some custom XSLT containing a correct url, or deriving the CQWP class and rewriting the url, I stumbled upon a great blog by Mike Johnson, about replacing some files fixing this issue.

Concluding; just replace a file and you’re done.

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot

Basic Search tips

04

Mar

Search within a SharePoint can be a bit of a challenge as I found out the last few days, so I decided to make a nice overview about what you can do with ‘search’ and what can’t do (with some nice examples). So in a small series of what you can do this is the first, with some basic info about the search and its properties.

According to this MSDN article there are 3 values that can be passed in the URL to the search results webpart, in order to define your resultset. The first property: K, which should contain your searched value (it says you can only use one value for this property). Next is the V, that can be filled either with relevance or with date, and determines the sorting of the results. And the final value is start, which contains the starting page of the results.

Here it looks like the MSDN article is a bit out dated, since most of you knows the S property for the Scope.  So actually there are four properties (that I know of):

Property

Description

K

Specifies the searched value

V

Specifies the sorting of the result set

Start

Specifies the starting page

S

Specifies the scope in which will be searched

 

Luckily for us the K query string allows us to actually do a lot more than just passing the searched keyword. It also allows the use of and + for excluding or including additional terms.

Property

Description

-

Excludes a term

+

Includes a term

 

Not only does the K property allows you to pass search words, it also allows you to use MetaDataPropperties, (that will be discusses in the next post).

The sorting of a result set  is something where SharePoint lacks the properties you want it to have, you can’t sort on date / name, so you actually have to find yourself a nice hack (that will be discussed in the 3th post).

The starting page is something I have never used before, that part is completely handled by your paging control.

The Scope property however is something that you will learn to love, it allows you to create scopes, and those will help you create a better result set. For instance you have a list where you store all your orders, and you want to search that. Scopes allow you to specify the result set. Not only by location but with ANY!  MetaDataPropperty that has it enabled.

So the next post will be all about MetaDataPropperties, that will allow you to search not only the common used properties, but everything you want. (it will also explain how you can use custom properties in your search results).

 

Albert-Jan Schot schreef

Comments (0)

Albert-Jan Schot