Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Is it possible to search only within certain categories?

Quote Reply
Is it possible to search only within certain categories?
I am not sure how can this be setup and any help would be very much appreciated.

Lets assume there are 20 Top Level Categories, however I want to limit search function to only Category No. 1 to 16 and want to exclude category no. 17 to 20 from the general search results (these categories will have their individual search function options). Any thoughts on how this can be done?

Thank you.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Is it possible to search only within certain categories? In reply to
~~ anyone? ~~

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Is it possible to search only within certain categories? In reply to
Hi,

I have done this by hard coding the names and values of those categories into the search form. I use a mini search form on each page.

For example :

<option selected="selected">all categories</option>
<option value="1">The Arts</option>
<option value="2">Entertainment</option>
<option value="3">Reference</option>
<option value="4">Publishing</option>
<option value="5">Broadcasting</option>
<option value="6">Events</option>
<option value="7">Advertising</option>
<option value="8">Marketing</option>
<option value="9">Others</option>

In this example if no value is provided then it will search all categories, otherwise it will search in the specific category. Hope this helps

John
Significant Media
Quote Reply
Re: [Jag] Is it possible to search only within certain categories? In reply to
Hi John,

Thank you for the reply. I assume there must have been some misunderstanding in my wording.

This is what I am looking for.

Suppose below are top level categories.

Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 7
Category 8
Category 9
Category 10

Now What I want is.. When users types in the search word, it will search 'in' categories from 1 to 7 (& all sub categories under 1 to 7). but not 8, 9 & 10.

I understand that if I just put in category number it will search within that category and all sub category under it. However how do I manage to limit search within just category numbers from 1 to 7 (All 1 to 7 and not just individual).

In our upcoming software directory, there will be about 15 top level software category. & 5 top level support and other content category. So I want to limited the search just for software category.

Any thoughts?

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Is it possible to search only within certain categories? In reply to
Hi,

You're correct I didn't read it properly.

So you want to exclude a set of categories from the results while including another set of categories ?

I'm guessing the search script expects a (one) value for the category, maybe have a look at the help file about the search to see if you can define category values to include at the same time you define values to exclude.

I think you may need a global for this otherwise.

John
Significant Media
Quote Reply
Re: [Jag] Is it possible to search only within certain categories? In reply to
I have done something similar where I had a few categories that I wanted permanently excluded.

Add a field to the Links table called 'Type' that sets what type of link it is (e.g. 'Software' etc.).

Then in admin/Links/User/Search.pm, find the line marked:

Code:
# Make sure we only search on validated links.
$IN->param('isValidated', 'Yes');
and add this below:

Code:
$IN->param('Type', 'Software');
This limits the search to only links of that type. I'm sure this could be expanded or improved on with a global or plugin but it worked for me as a quick solution.
Quote Reply
Re: [aus_dave] Is it possible to search only within certain categories? In reply to
Hi Aus Dave,

Thanks for the reply.

isValidated : I will be having even the content information validated, as they will also be added using the admin add link form, just the output will be based on different template.

In addition, I do not wish to disable search for other categoreis completely, instead those categories will have their separate search function.

So in other words, top level categories will be divided into 2 sections, Software Listings & Content Information.

I thought of creating another category field such as "Software Listing" & "Content Information" and name those top categories as such, however still am not sure how to setup a search (hopefully without having to edit any GLinks source code & just setting up form or globals) so it will be able to search each group separtely.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Is it possible to search only within certain categories? In reply to
Hi, I kinda figured out a work-around for it.

I created a link property field 'link_seach' with yes/no option. And as Software Directory will be having over 99.5% listings and content will be only .5%(less than 200 pages), I set link_search default to Yes and while adding content, I can set them to No. And within search result page, I can set Yes and No based on the search form.

So far testing seems to be producing desired results.

Thanks again.

Vishal

Vishal
-------------------------------------------------------