Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-08 22:36:10

cuda
Member
From: Georgia, USA
Registered: 2008-02-06
Posts: 70
Website

Advanced search

I am looking to create an advanced search that will look at specific custom fields and come up with a search score when an advanced search form is submitted and return the articles…. Has anyone ever used a custom site search vendor that integrated with textpattern to provide this kind of functionality? Thanks for any direction

Offline

#2 2009-01-08 22:53:33

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Advanced search

There is a fairly new plugin by wet.

Textpattern’s full text index uses the articles’ body and title contents to find proper matches for site-internal searches.

wet_haystack is a plugin for Textpattern CMS which allows site publishers to modify this default behaviour by adding additional article fields to the set of indexed content.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-01-12 16:25:32

kevinpotts
Member
From: Ghost Coast
Registered: 2004-12-07
Posts: 370

Re: Advanced search

I guess my main question is why the score would only be tallied based on custom fields. To me a more universally useful plugin would be one that tallied scores based on all fields related to an article with perhaps a means of filtering on the backend to emphsize some more than others. (Keywords and article Title might have more weight than Excerpt, for instance.) Hope that makes sense.


Kevin
(graphicpush)

Offline

#4 2009-01-12 18:23:06

cuda
Member
From: Georgia, USA
Registered: 2008-02-06
Posts: 70
Website

Re: Advanced search

mattd – thanks for the info that will be a useful plugin

Kevin – First I have found a great deal of helpful info on your blog over the years, thanks. Now let me clarify what I am talking about. You have an advanced search form to search for widgets for sale. You want results for widgets that are 2ft long, priced between $5-$50 and located in Oregon. Each one of those values would be in a custom field that would need to be searched for a match…… So the form would have more then one input not just the standard one input box search something along the lines of this: http://www.gutenberg.org/catalog/world/search

Offline

#5 2009-01-13 08:33:25

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: Advanced search

glz_custom_fields (and here, not free though) will help you part way as it allows you to build multiple dependent drop-down searches of a kind that are linked to its custom fields. If I recall correctly it doesn’t interact fully with all the other search methods, though so it depends partly how you build your forms and articles.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2009-01-16 19:09:26

kevinpotts
Member
From: Ghost Coast
Registered: 2004-12-07
Posts: 370

Re: Advanced search

Now let me clarify what I am talking about. You have an advanced search form to search for widgets for sale. You want results for widgets that are 2ft long, priced between $5-$50 and located in Oregon. Each one of those values would be in a custom field that would need to be searched for a match…… So the form would have more then one input not just the standard one input box search something along the lines of this: http://www.gutenberg.org/catalog/world/search

I understand now. It’s brilliant. Let me know when it’s done. :)


Kevin
(graphicpush)

Offline

#7 2009-01-16 19:30:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: Advanced search

cuda wrote:

You want results for widgets that are 2ft long, priced between $5-$50 and located in Oregon.

I know it’s a cheat but depending on the number of articles you are searching, can you use a technique like this ? I’m not sure about the ‘score’ part of it but you can certainly filter min/max values and matches fairly easily using smd_if and/or some nested conditionals (depending on how bullet proof you wanted it).

Perhaps adi_gps can help to get everything on the URL line out to a set of <txp:variable /> tags and then you can use smd_if to compare those values against each article and each time an article field matches, update a <txp:variable /> counter for that article (or perhaps rvm_counter can help here?). Then you can output all the articles and display the score or “weight”; higher values mean more terms matched. I dunno about sorting them in score order, though; would have to think about it.

There are probably more elegant ways to approach it but my brain’s cold at the moment. Does that trigger any better ideas?

Last edited by Bloke (2009-01-16 19:31:00)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2009-01-16 22:08:26

cuda
Member
From: Georgia, USA
Registered: 2008-02-06
Posts: 70
Website

Re: Advanced search

That is an interesting solution Bloke…. We will see. As far as sorting the results what I do now is pass the search string back in the sort button, whatever option it may be, with another variable that changes the sort of the query so from desc to asc or whatever it might be.

Offline

Board footer

Powered by FluxBB