Simple text search, is there an easier/better way.

Vic Carter asked on June 2, 2015 17:32

I need to do a keyword search on a custom table and then pull back a list of documents that are associated with the relevant records.

My current plan is to write a user control that will take a search term and pass it along to a filter web part, which will then connect to a datasource and pull relevant data via query.

Is there an easier way to do this?

Could I simply add my code(basically a button triggered redirect with a querystring) to a script block at the top of my template? Something like this:

protected override void OnInit(EventArgs e)
    // the Click event of the Button control.
    btnFilter.Click += new EventHandler(this.FilterBtn_Click);

private void FilterBtn_Click(Object sender, EventArgs e)
   string filterString = "/Products/Find-Products.aspx?st=" + txtSearch.Text;
   if(txtSearch.Text.Length > 0 ){ 
       txtSearch.Text = "** Required **";

The reason for not wanting to create a user control is that I do not have direct access to the kentico environment and must submit requests of this nature to the clients sys admin, which makes debugging a bit harder than it should be.

Thanks in advance. I am going to try the code posted above but any feedback is appreciated.

Recent Answers

Brad Vrudney answered on June 3, 2015 19:16

This is what the smart search module is built for. Is there a reason you don't want to use this system?

0 votesVote for this answer Mark as a Correct answer

Vic Carter answered on June 3, 2015 19:43 (last edited on June 3, 2015 19:45)

Thank you for your response.

The reason that method is not appropriate is that I am not actually trying to return results from a custom table. The client wants to return products that are associated with the custom table data. So in my example, I have a specification custom table and a product document type. The content editor can associate multiple specifications with a given product document. There is an existing search that uses a standard smart search index for direct query of the product documents. What I am creating is a specification search that allows the user to enter a specification name, grabs the guid from the custom table, then queries the product documents specification field for a match and returns a list of products that are associated with any relevant specifications.

Smart Search does not allow for custom queries(as far as I can tell).

My ultimate solution was to add standard ASP controls to my template and use a function to pass parameters into a datasource webpart connected to a universal viewer as my result set. This allows both my product specific and specification search to exist on the same page and function independently.

The reason I am not using a filter is the requirement that user entered text be free form and not a selection from an available list of specifications.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.