Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to make my search?

Quote Reply
How to make my search?
I hope my english is enough to explain my problem and i hope someone has an answer for me.

Say we have a lot of Links for cars. Say we have cats for 120 different colors.
Say every Link is in around 20 till 40 categories, means could have these colors.


Now i have the following ideas how to search with a form:

1. Save all catnames in the dataset of a Link and use the search.cgi, my form sends the color names and everthing runs like normal.
b) Instead of words for the colors i save shortnames like col1, col2 to save chars.

2. Make a SELECT like: Select from Links where Link is in the following cats. SELECT FROM Links, CatLinks, Category where ... CategoryID IN [..]

3. Instead of Names of the cats i store only the ids of the cats in Links.colors and make a query (with php) like SELECT FROM Links where x,y,z is in Links.colors.


My idea:
1. I will have a lot of chars in my table; for 1000 cars with 20-40 colors and in my language 5-15 chars per color.
1b. The same but less chars in the table.

2. This query seems to be a hard one, i believe in 10.000 visitors and more in a day and they will use this search very often.

3. Lighter query i think, but there is no indexing for the textfield. (i have used this for a smaller site, where i have only 20 cars, so the search never has to watch for more than this 20.)


I hope someone has an idea what i should do. :)

Last edited by:

Robert: Dec 17, 2009, 6:15 PM
Quote Reply
Re: [Robert] How to make my search? In reply to
Hi,

Not 100% sure what you mean - but have you tried doing something like search.cgi?query=*;color=red (or whatever your color field is)

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] How to make my search? In reply to
How to make my search:

Categories red, blue, green (more than 100 colors)

Way 1:

Links. colors = text
Save all used category.names in Links.colors
Use search.cgi

Way 2:

Links.colors = text
Save all category.ids in Links.color like |1|34|89|
Query with php, SELECT FROM Links WHERE Links.colors = %|ID|% AND/OR %|ID|% ...
The || is important, because search for 32 should not hit 320. Example: Search %|32|% from |32|320|

Way 3:
Query with php; SELECT FROM Links, CatLinks, Category WHERE Link is in Category x,y,z

Which is the best way, is there a better way?
I use LSQL only as the base for my site, i have different administration-tools written in php to make a lot of things more than normally possible with LSQL.

I dont want to search for cats, i want to search only for Links that are in the cats x,y,z as AND or OR-Search.


At the moment i prefer the following:

Make Category.tag as a 4-letter-tag like 1000+Category.ID
Save all tags from used cats in Links.tags

My form gives select-fields like [select][option value=4-digits]color[/option][/select]
Search only in Links.tags not in other fields.

For this i have to solve the question how to pass to search.cgi an array of search-words instead of one field.
And how to make this: Count * with AND, if there is no result, count* with OR, if result, start the query.

I am not really good in perl, so i would prefer the way 2 or 3 in php, but i am afraid that these queries are to slow and heavy.

Finally my way number 4 could be to use way 1, but make a copy of search.cgi in php.
Quote Reply
Re: [Robert] How to make my search? In reply to
Hi,

Mmm, not sure to be honest , not sure how much help I can be with this, sorry Frown

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!