Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Search other fields - No keyword

Quote Reply
Search other fields - No keyword
I have searched and read as much as I can find about this subject but nothing really gives a clear answer.

Im trying to setup a more advanced search, where visitors can narrow down the search by using different drop down boxes. These boxes are all related to different custom fields.

I have fields with several options such as: colour.. you can select white, black, blue etc..

I also have dropdown box for category, which would restrict the search to only a certain category. This works fine.

However when using any other extra option / fields to narrow down search it does not work.

For example, If I select blue in the drop down box for colour and do a search. The search result is not restricted to any link with the blue option selected. The search result shows all links no matter what is selected in this colour field..

If I even try a search with the no keyword at all, ie leave the keyword box empty. and just try and search by the fields provided. For example select blue and press submit... it comes up with nothing. Even if there is for sure links with blue selected.

Why does it work ok with category but not with any other custom field. I want to make it possible to narrow down searches and even do searches without keywords but just selection on custom fields.

How can this be done?

Thanks
Quote Reply
Re: [demon] Search other fields - No keyword In reply to
Hi. Hows this work;

search.cgi?query=*;Otherfieldname=test

For one of my sites, where I wanted a similar thing to be done (and not have to pass in "query"), I had to modify /admin/Links/User/Search.pm.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [demon] Search other fields - No keyword In reply to
Hmmm.
To Add To Woes,
I just select a Top Category (where obviously Posting Links Is Not Allowed, meaning That All Links Within A Root Category Has To Be Within One/More Of it's Sub Categories) And Do A Search With Find Exact Words Selected... Guess What ... I Search For Domain and I get results with SubDomain which is irrelevant totally to the search term

HyTC
Quote Reply
Re: [Andy] Search other fields - No keyword In reply to
I kind of see what you mean, but that would mean a user can only do a search for either: keyword (query) OR by dropdown menus..

IE that would be 2 different search forms and you could not then restrict or narrow down a keyword search by using other fields. Is that correct?

I guess that could work as well, just that they have to either do it by extra dropdown menu options OR just by keyword.
Quote Reply
Re: [demon] Search other fields - No keyword In reply to
Should work.

search.cgi?query=&Otherfield=something

If not, then you could hack /admin/Links/User/Search.pm, and find;

Code:
# If query is set we know we are searching.
return search() if defined $args->{query} and $args->{query} =~ /\S/;

... and add below it;

Code:
return search() if defined $args->{fieldname} and $args->{fieldname} =~ /\S/;

Then try a search. It *should* work with the additional field you added now, without having to enter a query :) Dirty hack, but its been working well for ages on Ultranerds =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Search other fields - No keyword In reply to
Thanks, I will try both and see what happens!

Thank you!
Quote Reply
Re: [Andy] Search other fields - No keyword In reply to
Just sat down and had a look at it.

How do you actually mean to do it with: search.cgi?query=&Otherfield=something
Do you mean to add that string on to the form action statment? But I have 5 custom fields, each with severl options. So do I need to add in =&otherfield for each field I have? Are they not added on to the queary when selected in form?

IE if someone selects from a dropdown menu the colour: white
And from a second drop down box they select: yes
Would this be added on automatically to the search.cgi? string??

Just not sure how that works and what exactly you mean by it.. Hopefully I can work it out with some help! Would improve the search function a lot if you can actually narrow down searches with dropdown options.

Thanks again!

Last edited by:

demon: Sep 9, 2004, 4:07 AM
Quote Reply
Re: [demon] Search other fields - No keyword In reply to
http://www.gossamer-threads.com/...i?post=271631#271631

Take a look at: http://www.buy-a-poster.com, which is my site, running on LSQL. I just have some which are dynamicly generated, while the Yes/No ones are hard-coded). This basically lets people narrow down their search param's :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [HyperTherm] Search other fields - No keyword In reply to
In Reply To:

Guess What ... I Search For Domain and I get results with SubDomain which is irrelevant totally to the search term

HyTC
I still have yet to read a claer answer to this..