Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-10-17 06:34:34
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Point me in the right direction - Search with Multiple Criteria
Could someone point me in the right direction as to how this could be done. I am using the custom fields to assign attributes to an article. Let’s say these are size, colour and type. I want to create a search (in addition to the standard word search) that would allow me to search on these three custom fields. Find all articles with the attributes Custom1 = Red, Custom2 = Large and Custom 3 = Fancy. A result list would then be generated as normal. Am I to assume that would need changed to the core textpattern code or could it be done somehow with embedded php on pages and/or forms. I have tried the latter with not much success. Maybe I’m not doing it right.
Offline
#2 2005-10-19 01:10:20
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Re: Point me in the right direction - Search with Multiple Criteria
Before I posted this question and looked around and found other similar questions unanswered. Is there a reason for this? Is it an unreasonable question to ask? Too difficlut to do? Just wondering.
Offline
#3 2005-10-19 23:58:26
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Re: Point me in the right direction - Search with Multiple Criteria
bump
Offline
#4 2005-10-20 00:55:46
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Point me in the right direction - Search with Multiple Criteria
I don’t think custom fields are going to be what you are looking for. Try looking at the capabilities that keywords allow for. You can use them as attributes in <code><txp:article /></code> and <code><txp:article_custom /></code>
<a href=“http://textpattern.net/wiki/index.php?title=Txp:article_/”>Docs</a> here might help.
Custom fields will allow you to add associated information to an article display or form, but they can’t be used as functional tagging the way keywords can.
[edit] Just noticed <a href=“http://forum.textpattern.com/viewtopic.php?id=12082”>this</a> as well, definitely worth looking into.
Last edited by rsilletti (2005-10-20 01:01:39)
Offline
#5 2005-10-20 02:54:26
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Re: Point me in the right direction - Search with Multiple Criteria
Firstly, let me say thank you for responding. I do believe that it is custom fields that I want as I need to have the structure that custom fields provide. That is each article has with it specific fields eg: Size, Colour, Style, Price ….. etc etc.
I need to so a search like find all the articles where Style = Fancy and Colour = Red and Size = Large and Price < $20. I suspect that I may need to hack the Textpattern search function.
Offline
#6 2005-10-20 05:40:24
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Point me in the right direction - Search with Multiple Criteria
The best way to extract speific information, or screen for it, would be mysql queries. If you are going to go to the level of detail that would be entailed with hacking the search function, you would probably find it easier in the end to write some plugin functions specifically aimed at the information you want.
I wrote some file download functions that you could look at <a href=“http://textcastle.com”>here</a>, might give you some ideas.
Offline
#7 2005-10-24 10:29:47
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Re: Point me in the right direction - Search with Multiple Criteria
OK I will need to look at modifying the search. Does anyone know where in the code where the database is queried against the search field?
Offline
#8 2005-11-02 20:55:19
- davidm
- Member
- From: Paris, France
- Registered: 2004-04-27
- Posts: 719
Re: Point me in the right direction - Search with Multiple Criteria
I agree with Chief this would be a nice thing to add custom fields search capability to the internal search engines. It certainly makes a lot of sense if you use custom fields to create, say, product information.
.: Retired :.
Offline
#9 2005-11-04 08:48:51
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Re: Point me in the right direction - Search with Multiple Criteria
This is a good start. http://www.paland.net/blog/383/textpattern-suche-auf-custom-fields-erweitern from alice_c
Offline
#10 2005-11-04 09:27:20
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Point me in the right direction - Search with Multiple Criteria
Did you also read this thread?
Offline
#11 2005-11-05 01:40:16
- Chief
- New Member
- From: Maleny, Queensland, Australia
- Registered: 2005-08-06
- Posts: 9
Re: Point me in the right direction - Search with Multiple Criteria
The feedback given to the feature request asking for a search on all the custom fields suggests that such a search is going to be slow. This may be so, but there are many people requesting such a feature and the solution maybe??? to split the search into a simple search and comprehensive search. I think that if people want to do a comprehensive search then it is reasonable for it to take longer. Response time is also a relative thing, dependent on many things, the processing power of the server, the number or articles, the number of custom fields being searched, the value of the data being retrieved etc etc. This is a matter for the site designer to take in account. i.e Use this feature knowing the implications. As I believe there is support for such a feature, the answer is in how it would be delivered/implemented and not to dismiss it as “that will just be too slow”. I’m sure there is worthwhile point in between.
Offline