Thursday, April 19, 2012

Searching Like a Native

A user in the Yahoo! Intradoc Users forum asked a really interesting question.
He was looking for a way to conduct database specific searches from the user interface in such a way that the database’s native functionality could be leveraged.

Well, let's put on our thinking caps, shall we?...  hmmm...

- I need a way to conduct searches in a more native fashion in UCM.
- I'm not really wanting to bust up my Content Server, because this will be a gnarly change.

The answer is (a drum roll please...) - a Content Server profile.

You might ask, "Have you lost your mind?"  Well, not totally. I've done this type of thing before.

Let me explain. Content Server has basically given you options to conduct queries in lots of ways. You just have to know and use the right flags. Keep in mind that the Content Server search works off a beast called a datasource, which is a partial query that mostly looks for a WHERE clause to execute.

- So your steps (assuming here that the Content Server is configured for full text searching - you'll need the full text box later.):

1. Create a new profile and one profile rule in Configuration Manager. For kicks, make the profile rule a search only profile, on request.




2. In the profile side effects set the following as shown:

<$SearchEngineName="DATABASE"$>
<$SearchQueryFormat="Native"$>




3. Save the rule, and add it to your new profile. Close the admin applet, and go to your newly created profiled search page.

4. Go down into the fulltext box and enter "FREETEXT(dDocTitle, 'weather floodcar')", or the appropriate "native" SQL WHERE clause for the situation and applicable to your database – minus the WHERE keyword.   (I used an IN statement for the example below.)



5. Click “Search”. Voila (or wah-wah-wah), depending on your query.

Your mileage definitely may vary, but it's a neat way to get at some of the more interesting functionality of the underlying database.