Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2013-08-19 21:42:40
- wauterboi
- Member
- Registered: 2013-08-19
- Posts: 11
Help with Advanced Search
Hey, I’m working on a site that archives maps over at http://dotbsp.com/ and I would like to expand on the search features on the right.
What I would like to do is have two dropdown menus – one for the game (which are currently article categories), and one for specific keywords. And I would like to have a form for the user to type in for individual keywords.
So, for example, the user could select “Left 4 Dead” in one drop down menu, “Large” in the other drop down menu”, and zombie in the text box. And the resulting search would search for “large zombie” in the Left 4 Dead category.
The problem I have is I have no idea how I would go about doing this. Every approach I would have taken seems to be either not very possible or a bit crazy. For example, it doesn’t seem like searching by multiple categories is possible out of the box.
What would be the best solution?
Last edited by wauterboi (2013-08-19 23:37:11)
Offline
#2 2013-08-20 10:26:42
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Help with Advanced Search
Have you seen this topic already?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#3 2013-08-20 10:57:50
- wauterboi
- Member
- Registered: 2013-08-19
- Posts: 11
Re: Help with Advanced Search
Yes sir. It’s extremely confusing, and when copy+pasting his examples exactly as they appear on the page, I get this:
Tag error: <txp:article_custom Features=’<txp:variable name=“Features” />’ /> -> Textpattern Notice: Unknown tag attribute “features” while parsing form “SearchResults” on page “search”
It would be amazing if I could just search by two categories with the textbox, or some other way to search by map size:
dotbsp.com/?c=counter-strike-source&size=large&q=de_wanda
If I attach a custom field named “mapsize” to it – is there a way to have it search in the counter-strike-source category and filter out anything that doesn’t match the mapsize?
Last edited by wauterboi (2013-08-20 11:41:56)
Offline
Re: Help with Advanced Search
I think that Features is the name of a custom field. You can replace that with a custom field name in your setup.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Help with Advanced Search
wauterboi wrote:
If I attach a custom field named “mapsize” to it – is there a way to have it search in the counter-strike-source category and filter out anything that doesn’t match the mapsize?
Yes, if you replace <txp:article />
with
<txp:etc_query globals="_GET,_POST" specials="content">
<txp:article mapsize="{?size|%}" />
</txp:etc_query>
then dotbsp.com/?c=counter-strike-source&size=large&q=de_wanda
should give you what you need.
Offline
Re: Help with Advanced Search
As the site itself goes, I would concentrate more to stuff that isn’t Source Engine games. There are tons of portals for Valve’s games, the engine itself then has downloads support, and Valve’s own games integrate with Steam Workshop.
One thing that you could do to make distributing the maps easier to end users, is it to create an authored high quality map collection(s) on Steam Workshop. That way you too make sure that you are always distributing the correct version of the map. And whats better than single click installs or subscribing to collections.
Last edited by Gocom (2013-08-20 15:16:32)
Offline
#7 2013-08-20 19:54:51
- wauterboi
- Member
- Registered: 2013-08-19
- Posts: 11
Re: Help with Advanced Search
Putting that in the search_results form got me this:
Tag error: <txp:article mapsize="large" /> -> Textpattern Notice: form_circular_reference: search_results while parsing form “search_results” on page “default”
So somewhere it’s looping? That’s strange.
EDIT: It’s weird. I have an article with it’s mapsize set to “large” and its name is de_wanda. It’s in the counter-strike-source category. Searching for exactly that brings back that error twice. Changing the search’s mapsize variable to medium or small only brings it back once.
Gocom wrote:
As the site itself goes, I would concentrate more to stuff that isn’t Source Engine games. There are tons of portals for Valve’s games, the engine itself then has downloads support, and Valve’s own games integrate with Steam Workshop.
One thing that you could do to make distributing the maps easier to end users, is it to create an authored high quality map collection(s) on Steam Workshop. That way you too make sure that you are always distributing the correct version of the map. And whats better than single click installs or subscribing to collections.
I plan on doing a lot of Steam Workshop stuff and paring it with what I’ve got going. The website’s meant to be an archive so if the maps disappear from the Steam Workshop, the map still exists on the site.
Last edited by wauterboi (2013-08-20 20:04:00)
Offline
Re: Help with Advanced Search
wauterboi wrote:
Putting that in the search_results form…
is a bad idea, put it in the if_search
part of the corresponding page
template.
Offline
#9 2013-08-20 20:36:13
- wauterboi
- Member
- Registered: 2013-08-19
- Posts: 11
Re: Help with Advanced Search
http://dotbsp.com/?c=counter-strike-source&size=large&q=wanda
^ It doesn’t seem to return anything. I put this in my default page template, by the way:
<txp:if_search>
<txp:etc_query globals="_GET,_POST" specials="content">
<txp:article mapsize="{?size|%}" />
</txp:etc_query>
<txp:else />
<txp:article limit="5" form="default" />
</txp:if_search>
Offline
Re: Help with Advanced Search
Since http://dotbsp.com/?q=wanda
doesn’t bring anything, you should check if the corresponding article’s section is searchable (Presentation/Sections/Include in site search). To be sure, you can temporarily re-replace <txp:etc_query />
block by <txp:article />
.
Offline
#11 2013-08-20 21:25:34
- wauterboi
- Member
- Registered: 2013-08-19
- Posts: 11
Re: Help with Advanced Search
The Maps section is searchable and it came up when I used the default txp: search – I don’t know why it’s acting up now that it’s in the page template.
<txp:article /> brought up nothing either.
<txp:if_search>
<p>TEST!</p>
<txp:article />
<!-- <txp:etc_query globals="_GET,_POST" specials="content">
<txp:article mapsize="{?size|%}" />
</txp:etc_query> -->
<txp:else />
<txp:article limit="5" form="default" />
</txp:if_search>
EDIT: I fixed it – I overwrote the search_results like a dolt and now the right articles are showing up just as they should. Thanks a ton etc, and all of you other guys too!
Last edited by wauterboi (2013-08-20 21:53:46)
Offline
Re: Help with Advanced Search
You are welcome. Now, if you replace your search form by
<txp:etc_query data="your search form" globals="_GET,_POST"
replace='//select[@name="c"]/option[@value="{?c}"]@@selected=selected;
//select[@name="size"]/option[@value="{?size}"]@@selected=selected;
//input[@name="q"]@@value={?q}'
/>
then the searched game and size should be preselected in the form. And check the duplicated search-option
id.
Offline