Jump to content

How to make links to advanced forum search results


stryd_one
 Share

Recommended Posts

First: Newbies, just use this: http://www.midibox.org/forum/index.php?action=search;advanced;search=

Thought this may be useful. Props to AudioCommander for finding this. I'm just filling in some extra info...

First, the basic URL:

http://www.midibox.org/forum/index.php?action=search2;advanced;search=<blah>

Put your search term where it says <blah>, so if you wanted to find all posts where someone mentioned the word "foo", it looks like this:

search=foo

If you want part of a word, you can use an asterisk as a wildcard like so:

search=foo*

If you want to use multiple search terms, you can specify them like this:

search=foo+bar

Or for exact terms, you can use quotes:

search="unsigned char foo"

If you use multiple terms, you can tell the search how to use them as such:

searchtype=1 is "Match all words"

searchtype=2 is "Match any word"

EG:

search=foo+bar;searchtype=2

If you want to search for posts by a certain user, use 'userspec' like so:

search=foo+bar;userspec=stryd_one

or if you're not sure of the nick exactly:

search=foo+bar;userspec=stryd*

If you want to see messages of a certain post date, you can use 'minage' and 'maxage', so if you wanted to see stuff from last month, you might do:

search=foo+bar;minage=30;maxage=60

To see posts between 30 and 60 days of age

You can push maxage out to '9999' to get everything back to the beginning of the forum.

If you want to see the entire posts in your results (not just the summary) do this:

search=foo+bar;show_complete=1

If you only want to search for your text in the subject, try:

search=foo+bar;subject_only=1

To control the sorting of your hits, use the 'sort' parameter as such:

'sort=relevance|desc' is Most relevant results first

'sort=numReplies|desc' is Largest topics first

'sort=numReplies|asc' is Smallest topics first

'sort=ID_MSG|desc' is Most recent topics first

'sort=ID_MSG|asc' is Oldest topics first

For example to sort by most recent posts do:

search=foo+bar;sort=ID_MSG|desc

And to specify which boards to search, use 'brd=' as such:

'brd=1,36,33,37' is the 'Top' section of the forum

'brd=1' is Latest News

'brd=36' is Bulk Orders

'brd=33' is Frequent Writer Lounge

'brd=37' is Programmers Lounge

'brd=14,15' is the 'Archive' section of the forum

'brd=14' is Parts Archive

'brd=15' is MIDIbox of the Week

'brd=29,26,27,28,35,5,2,3,4,6,7' is the 'Construction' section of the forum

'brd=29' is MIDIbox HUIs

'brd=26' is MIDIbox SID

'brd=27' is MIDIbox FM

'brd=28' is MIDIbox SEQ

'brd=35' is MIDIbox User Projects

'brd=5' is MIDIfication

'brd=2' is Design Concepts

'brd=3' is Parts Questions

'brd=4' is Testing/Troubleshooting

'brd=6' is Tips & Tricks

'brd=7' is MIDIbox Documentation Project

'brd=32,31,12,13,38' is the 'Miscellaneous' section of the forum

'brd=32' is Sale Requests

'brd=31' is Fleamarket

'brd=12' is Miscellaneous

'brd=13' is Songs & Sounds

'brd=38' is Trash Can

'brd=16,17,18,19,20,21,22,23,24' is the 'Multilingual' section of the forum

'brd=16' is Nordisk

'brd=17' is Nederlands

'brd=18' is Deutsch

'brd=19' is Français

'brd=20' is Italiano

'brd=21' is Español

'brd=22' is Greek

'brd=23' is Russian

'brd=24' is Others

'brd=28,25,10,11' is the 'Software' section of the forum

'brd=8' is MIDIbox Tools & MIOS Studio

'brd=25' is MIOS programming ©

'brd=10' is MIOS programming (Assembler)

'brd=11' is MIOS toy of the week

So, for a big example of all of the options... Let's say you want posts by me, but you can't remember if I'm stryd_one or stryd_1... You want to search for posts where the word 'bitfield' or 'bitfields' or any word starting with 'bit' (in case i made a typo, like 'bitfeild', or said 'bit field') is used, but only in the subject... And posts only in the 'Software' section of the forum... excluding posts in the last 30 days, and only going back one year maximum... sorted to show the most recent posts first, and returning the full post as a result.... (phew) here's your example URL:

http://www.midibox.org/forum/index.php?action=search2;advanced;search=bitfield+bitfields+bit*;searchtype=2;userspec=stryd*;minage=30;maxage=365;show_complete=1;subject_only=1;sort=ID_MSG|desc;brd=28,25,10,11

Enjoy!

Link to comment
Share on other sites

I took a look at the SMF forum sources. The bad news is the form submission method in hard coded in the (rather convoluted) code.

The good news is that it seems like there are only a few places where the actual search forms are. I should be able to do the needed modifications pretty quickly.

I grepped the source tree for lines containing both method= and search2 (the search result action). These came up:

max@tor:~/tmp.smf_forum$ grep -R "method=" * | grep search2
SSI.php: <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
Themes/babylon/index.template.php: <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
Themes/default/PersonalMessage.template.php: <form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="pmSearchForm">
Themes/default/index.template.php: <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
Themes/default/Search.template.php: <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">
Themes/default/Search.template.php: <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">

I'm fairly sure that simply changing method="post" to method="get" should render all search forms to use HTTP GET parameters in the query string. Is there a develoment/staging instance of this forum where this could be tested? Testing on my own machine is sort of tricky as I'd have to set up Apache, PHP, and a suitable database, as well as populate it with data... :)

Link to comment
Share on other sites

Search query's needs to be parsed that is why post instead of get is used.

We have some hacks running that make use of the parsing as these hacks remember typed words that are being searched like the tagging option for example.

But most of all i really like to keep things at default as much as possible. This way i can upgrade whenever i like instead of going to a hideous phase of reapplying each hack again after an update. Also we now use 3 templates so i have to do this x 3

Link to comment
Share on other sites

I got a reply from simplemachines:

Search URLs are currently base64encoded to help prevent abuse,

particularly Denial of Service attacks, of the search system.  There is a

way to get a URL, however.

The link tree/breadcrumbs at the top of the search results page, if you

copy the link from the link that says "search results" it will act as a

link to re-perform that search.

It does seem to work like that, not perfect, but better than nothing... :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...