Simon Gibson

Site Search:
ASP.NET Search for Index Server ASP.NET Suche für den MS/Indexdienst ASP Search for Index Server ASP Site Search for IIS web sites

Using SearchSimon.NET with Index Server to search custom document properties and META tags.
(Windows 2000 Server, Professional, XP, Windows Server 2003)

This tutorial focuses on extending the functionality of SearchSimon.NET to allow custom document properties to be searched and displayed within your results page. The example shows how a "contractno" property from a Microsoft Word document can be added to a search catalog but the same process could be used for other document properties and custom META tags in HTML files.

About ASP.NET Search for Index Server (SearchSimon.NET):
SearchSimon.NET is an advanced search application written specifically for Microsoft Index Server (Indexing Services) and the .NET Framework. The application has been designed to offer as much flexibility as possible whilst remaining easy to configure and requiring little or no programming knowledge. For further information, take a look at the Product Page or try the Demos.

 
 

Figure 1

1. Custom Document Properties:
For this tutorial, I have created a new Microsoft Word document which contains a custom document property called "contractno". To allow us to check the success of Custom Property search feature of SearchSimon.NET I have assigned a value of "2004122501JC" which is very unlikely to appear in other documents within my Catalog.

Note: You can also search custom META tag properties of HTML documents such as the following:
<meta name="contractno" content="2004122501JC">

 
 

 
 

Figure 2

2. Rescanning your Catalog:
Once the document has been added, the Catalog will need to be completely rescanned. This process allows new properties (including "contractno") to be picked up by the Indexing Service and added to the catalog.

To rebuild the catalog, first stop the Indexing Service and then delete the appropriate "catalog.wci" file as shown above. Then, restart the Indexing Service. It may take several minutes for the catalog to fully rebuild.

Note: There are other methods which can be used to rebuild your catalog. However, I have found that this is by far the most reliable.

 
 

 
 

Figure 3

3. Catalog Properties:
Once the Indexing Service has finished rebuilding the catalog, you will notice that a new entry has appeared in your Catalog "Properties" list (as shown above).

Note: You may need to right-click on "Properties" and select "All Tasks", "Refresh List" for the new property to appear.

Right-click on the new entry and select "Properties" to open the Property Dialog box.

 
 

 
 

Figure 4

4. Property Dialog box:
In order for the "contractno" property values to appear within your results page, you need to check the "Cached" checkbox as shown above. The Indexing Service will attempt to detect the correct values for the other options within the dialog box so it's usually okay to leave them as they are.

Make a note of the values for Property Set and Property as displayed in your Property Dialog box. Shown below are the corresponding values from the dialog box above. We will need these values later.

Property Set: d5cdd505-2e9c-101b-9397-08002b2cf9ae
Property: contractno

Click "OK" to save the changes and click "OK" on the "Pending Change" popup that follows.

 
 

 
 

Figure 5

5. Rescanning your Search Directories:
You will need to completely rebuild your catalog again to allow the Indexing Service to index the values for the "contractno" custom document property. To do this, stop the Indexing Service, manually delete the appropriate "catalog.wci" file and restart the Indexing Service as in step 2. Again, this process may take several minutes.

 
 

 
 

Figure 6

6. Configuring SearchSimon.NET to search custom document properties:
Open "web.config" with Notepad (or your preferred text editor) and locate the "customfields" key as shown above.

This key can consist of as many custom document properties as you require. Each property "group" should be separated with a comma and the items within the "group" with a | (known as a "Pipe"). The format for one property "group" should consist of the following:

PROPERTY|PROPERTY SET|DATATYPE

The "Datatype" defines the type of data stored within the Property. In almost all cases this will be a simple string (DBTYPE_WSTR) so, using the values from Step 4 we get:

<add key="customfields" value="contractno|d5cdd505-2e9c-101b-9397-08002b2cf9ae|DBTYPE_WSTR" />

If you need to index multiple custom properties, separate each property "group" with a comma.

 
 

 
 

Figure 7

Figure 8

7. Configuring SearchSimon.NET to allow users to choose custom document properties:
You may want to add a selection to the "Properties" list within the SearchSimon.NET search page which will allow users to ONLY search your custom document properties (as shown above). To do this, simply open "web.config" and find the "Searchlist" key. Each selection is contained within a comma delimited list and contains a "Friendly" name and corresponding field name separated by a Pipe.

So, the format is as follows:

My Field A|customfielda,My Field B|customfieldb

Simply append the appropriate values to the end of the "Searchlist" key, making sure to include the delimiting comma and pipe in the correct place (also shown above). In our case, this is:

Contract No|contractno

 
 

 
 

Figure 9

Figure 10

8. Configuring SearchSimon.NET to show your custom document properties on the results page:
The results page can be easily modified to suit your requirements. Simply open "default.aspx" with Notepad and locate the "GetAuthor" line. You should then add an entry for your custom property as shown above. The format for this, should match the following:

<display name> <%# DataBinder.Eval(Container.DataItem, "<property>") %>

So, in this case the line to be added should read:

Contract No: <%# DataBinder.Eval(Container.DataItem, "contractno") %>

To try a working example, visit the SearchSimon.NET demo page here and search for 2004122501JC.

 
 
[Home] [3D Design] [Web Design] [Intranet/Extranet] [Personal]
Design and Content © Simon Gibson 2000 - 2010
[Email] [Site Map] [Search] [Privacy]
There are currently 25 users online.