Gossamer Forum
Home : Products : Links 2.0 : Customization :

Searching Category Fields

Quote Reply
Searching Category Fields
We want to make a directory which could be searched on fields in the links database and in the category database. Would it be easy to modify Links 2.0 to do it?

Here is an example of what we have in mind.

The directory would include links to web sites about prominent musicians. Each musician would be represented by a separate category, which would include fields for biographical and professional information. It is essential for us that the search engine would search and return results for the category fields, even if there were no links present.

We reckon it is possible, but would it be a simple thing to do?

Thanks for any help anyone can give. We have asked a similar question in the Links SQL Pre Sales forum.



Quote Reply
Re: Searching Category Fields In reply to
There is a CATEGORY SEARCH MOD listed in the Resources section for Links 2.0...also additional hacks to show results even if the keyword is not found has been posted in this forum.

As for Links SQL, there is a category search function out-of-the-box.

Regards,

Eliot Lee
Quote Reply
Re: Searching Category Fields In reply to
Thanks Eliot for your quick answer.

Can you tell me where this Links 2.0 mod is please? I can't find it.

I have looked through the whole list of Links 2.0 mods, and I have done a search in Resources on "category" returns 38 links, none of them applicable.

I have also searched the forums agains. After two hours I am feeling dizzy. Can't find anything relevant. Is the mod buried in a thread with a non-descriptive title?

All I have found is two inconclusive threads started by people with possibly-similar requirements:
http://gossamer-threads.com/...st&Number=117598
http://gossamer-threads.com/...st&Number=100952
and another which suggests that what I want to do is not possible
http://gossamer-threads.com/...ust&Number=81634


LinksSQL search does find empty categories, but I could not test the critical requirement, finding keywords in category fields, because the demo does not use any (not even category descriptions). It is not mentioned in the online documentation or walkthrough.


Quote Reply
Re: Searching Category Fields In reply to
Search for search redirection in both the Resources and also in this forum.

If you can't find the link, go here:

http://lookhard.hypermart.net/links-mods/

Regards,

Eliot Lee
Quote Reply
Re: Searching Category Fields In reply to
Sorry ... I just don't get it.

http://lookhard.hypermart.net/links-mods/ has nothing about searching category fields.

'Search redirection' in Resources returns 'No Matching Links'

Searching in this forum returns some threads which suggest using a second Links or DBMan database, eg:
http://www.gossamer-threads.com/...ust&Number=49496

I think I have failed to explain adequately what I want to do. It's not about search redirection -- if the keyword is not in the database, there would be no point in looking for it anywhere else -- it's about searching in categories.db as well as links.db.

I will try again, this time with reference to what I think is the program logic in the Links 2.0 search.cgi (I should have looked before my first post).

Search.cgi opens links.db, then scans it record by record, looking for the query keywords in the fields specified by the variable 'search_fields' as defined in links.def. If a match is found, it also looks in the links.db 'Category' field (by default not in 'search_fields'). It stores matching records in arrays 'link_results' and 'category_results'. Output is built from these two arrays after links.db has been scanned. But search.cgi never opens categories.db, and there is no equivalent of 'search_fields' in 'category.def'.

Assuming that there would be several new fields defined in category.def, I reckon the mod I am hoping for would do something like this:
1. After closing links.db, open categories.db, then carry out a similar search on allowed fields, storing the records which match.
2. Build output from (a) matching categories and (b) matching links.

In other words, an integrated search in one database. Right now, this does not look easy.

Perhaps we are trying to do something for which Links 2.0 was never intended: a database in which category fields are just as important as link fields. Perhaps, for a flatfile implementation, we should be considering DBMan rather than Links 2.0. LinksSQL on the other hand evidently does things differently. An out-of-the-box search can definitely pull out a category description, so (presumably) it can pull out other category fields, including new ones.
Quote Reply
Re: Searching Category Fields In reply to
After thorough investigation and testing of Links 2.0, we have a conclusion and answer to our own question.

It is possible to do it, but nobody has.
It would require an extensive re-write of search.cgi, and probably not worth the effort. DbMan would be better.

It is possible to do it in LinksSQL with modifications, and this is what we are looking at next.