Current version: 2.0

Diese Seite ist nur auf Englisch verfügbar. (Sie darf aber gerne auf Deutsch kommentiert werden.)

Let’s be honest: the search function included with WordPress is pretty dull. But now there is Advanced Search, and it’s definitely the plugin you are looking for. It does not only provide a bunch of advanced search options to tune the search, but it also uses a much more effective search method: MySQL’s fulltext search. The Advanced Search plugin is Free Software licensed under the GNU GPL.

Advanced Search can be either used as a full-blown form on a dedicated page, or it can be used in the sidebar as a lightweight form (AS Lite). And the best: All the great options and features can easily be fine-tuned by you, the blog owner!

Overview

Features

The search itself:

Intelligent Search: Can search for for words instead of strings (visitors can switch), Supports usage of boolean operators, Allows limiting the search to one or more categories and/or authors as well as user-defined periods, Allows setting the search scope to posts, pages and/or comments, Search results can be ranked by relevance or date,

Other features:

Features multi-color searchterm highlighting, You can use both versions, or only one – just as you like, Can invisibly replace the internal WordPress search, Sidebar form can be integrated as widget or template function, Form elements of large and lite form can be turned on/off via config file, Easy styling via dedicated CSS files.

Installation

Download

version 2.0, for WordPress 2.3 and higher

as .tar.gz archive (31.2 kB) as .zip archive (46.8 kB)

Please consider coming back for a donation. You’ll support our efforts and receive a backlink.

Have problems unpacking archives? Try the latest 7zip.

Download

version 0.6, for WordPress 2.0.x

as .tar.gz archive (28.1 kB) as .zip archive (41.9 kB)

Please consider coming back for a donation. You’ll support our efforts and receive a backlink.

Have problems unpacking archives? Try the latest 7zip.

First …

Download the correct package for your WordPress installation. The first package is for WordPress 2.3 or higher, the latter is for the legacy 2.0.x branch. Unpack it and upload the folder advancedsearch to your plugins directory,

The next steps depend on what usage you have in mind:

… if you want a full-blown search form on a dedicated page (the only option for the 0.6 version):

Activate the plugin Advanced Search in your admin panel, Create a new page with the title “Advanced Search” (or whatever you like), and the content <!--advancedsearch--> You might want to exclude the link from your pages listing in the sidebar and create another link to your Advanced Search page somewhere else, If you want, customize the CSS in the plugin’s advancedsearch.css to suit your taste. (for 0.6: copy the contents of ctas.css to your main CSS file.)

… if you want a sidebar search form:

Activate the plugin Advanced Search Lite in your admin panel, If you use widgets, go to the widget configuration and drag&drop the Advanced Search Lite to a suitable place in your sidebar(s). If you like hacking the templates old-school, open your sidebar.php and insert the following code <?php if ('true' == ASL_ACTIVE) echo as_form('asl') ?>. If you want, customize the CSS in the plugin’s advancedsearch-lite.css to suit your taste.

… if you want both:

Activate both Advanced Search and Advanced Search Lite, proceed as described above.

… if you want only the FULLTEXT feature for the built-in search form:

Activate either Advanced Search or Advanced Search Lite, then activate the universal search, as described in the advanced instructions (see below).

Upgrading

If you are upgrading, delete the Advanced Search plugin folder from your wp-content/plugins directory, then proceed as described above.

What else?

You can do a lot more with the Advanced Search Plugin. Details on enhancement, configuration, translation and technological background are available on the advanced instructions page. For frequently asked questions (and before posting a comment!), please refer to the FAQs.

Feedback and improvments are as always highly welcome. Please leave a comment below. That’s it! Have a lot of fun with the Advanced Search plugin!

In case you need individual, advanced support: Zirona also provides professional support for this software and its integration on your website (as well as WordPress support in general). Please don’t hesitate to contact us and ask about our services.

267 Kommentare zu „WordPress Advanced Search“

Monika am 7. Oktober 2006 um 19:08 #

Hi
length ist ein nicht wirklich erwünschtes Attribut bei input ..
außerdem kann man es dann nicht via style.css designen.

ich habe in meinen Testbeiträgen viele pre Tags drin. Die erweiterte Suche von Dir findet diese Beiträge nicht.

also wenn ich nach pre Suche kommt nichts, nur die hauseigne Fehleranzeige von mir. ich lande aber auch nicht wieder auf der erweiterten Suche - muss man da die statische Seite anpassen.

ich habe die Überschrift Pingback in meinen Blog , aber das Plugin findet diese nicht.

so weitertesten geh und danke sag… ;)
da test ich gern und suche ;)

Alex Günsche am 7. Oktober 2006 um 20:06 #

Hallöchen,

length ist ein nicht wirklich erwünschtes Attribut bei input ..
außerdem kann man es dann nicht via style.css designen.

Ich dachte eigentlich, dass die length ein gerade benutzerfreundliches Attribut ist. :-? Und bei mir funktioniert es eigentlich ganz gut, das Feld mit width anzupassen.

ich habe in meinen Testbeiträgen viele pre Tags drin. Die erweiterte Suche von Dir findet diese Beiträge nicht.

Das ist eines der weniger schönen Features der Volltext-Suche, die ignoriert nämlich von Haus aus Wörter mit weniger als vier Buchstaben. Falls Du aber Zugriff auf die MySQL-Konfiguration auf Deinem Server hast, kannst Du diesen Wert ändern.

also wenn ich nach pre Suche kommt nichts, nur die hauseigne Fehleranzeige von mir. ich lande aber auch nicht wieder auf der erweiterten Suche - muss man da die statische Seite anpassen.

Jep, das bietet sich an. Werde ich auch in die Dokumentation reinschreiben.

ich habe die Überschrift Pingback in meinen Blog , aber das Plugin findet diese nicht.

Seltsam… hast Du exakt nach Pingback gesucht, oder Ping* oder Ping?

so weitertesten geh und danke sag… ;)
da test ich gern und suche

Das wäre super! :-D

Monika am 7. Oktober 2006 um 21:50 #

Hi maxlength damit kann man die maximale Anzahl an Eingaben beschränken, also maxlength 50 bedeutet mehr als 50 Zeichen können nicht hineingetippt werden,

mich störts nicht, weil ich die Formulare sowieso alle auf xhtml ummodele :-)
fieldset legend label sind meine steten Begleiter ;)

ich versteh das mit den drei Zeichen , doch wieso kann das die simple hauseigne Suche von WordPress ?

Trackbacks/Pings
suche ich da nach Pings kommt ein nicht gefunden

:( das ist irre umständlich irgendwie -ist das nicht änderbar..
so eine erweiterte Suche wäre sonst der Hammer

snief weiter testen geh
lg

LK am 8. Oktober 2006 um 01:22 #

Great work. Your plugins are awesome. Any chance that you’ll be adding support for searching custom fields to this plugin?

Alex Günsche am 8. Oktober 2006 um 13:27 #

Hi LK,

glad you like my work :-)

Any chance that you’ll be adding support for searching custom fields to this plugin?

Absolutely. There will be support for Tags, Meta-Info and custom fields in one of the next versions.

Alex Günsche am 8. Oktober 2006 um 13:38 #

Hallo Monika,

Hi maxlength damit kann man die maximale Anzahl an Eingaben beschränken, also maxlength 50 bedeutet mehr als 50 Zeichen können nicht hineingetippt werden,

Ich Depp, ich habe length mit size verwechselt. Du hast natürlich recht, und ich werde das in der nächsten Version rausnehmen.

ich versteh das mit den drei Zeichen , doch wieso kann das die simple hauseigne Suche von WordPress ?

Das mit den 3 Zeichen ist eine Spezialität der Volltextsuche, da sie nach Wörtern und nicht nach Zeichenketten sucht. Die simple Suche prüft nur eine Zeichenkette gegen einen Datenbankeintrag, und da ist die Länge des Suchbegriffs egal.

Trackbacks/Pings
suche ich da nach Pings kommt ein nicht gefunden
:( das ist irre umständlich irgendwie -ist das nicht änderbar..

Kann sein, dass der Schrägstrich nicht als Trennzeichen interpretiert wird.

so eine erweiterte Suche wäre sonst der Hammer

Soweit ich weiß, arbeiten alle erweiterten Suchen in CMSen u.ä. auf Basis von MySQL-Datenbanken (z.B. auch die Wikipedia) mit dieser Volltext-Suche. Ich werde mir mal anschauen, wie die solche Probleme lösen.

LK am 9. Oktober 2006 um 00:52 #

Glad to hear that custom fields will be included in upcoming release!

My dream would be to have an option to search on each custom field separately. For example:

- in box 1, search for posts that have value X for custom field A
- in box 2, search for posts that have value Y for custom field B
- the search result would return just posts that meet both criteria

That might be outside the scope of what you’re envisioning, but I think it would be helpful for those of us using WP for more CMS purposes. (We’re trying to create a searchable directory of homeless shelters.) Thanks for your contribution of this code!

Jo am 9. Oktober 2006 um 14:04 #

I’ve installed the plugin and it seems to be working ok (1000+ posts) though I’d prefer it if the categories were listed in the same way as I list them in the sidebar: alphabetically and with the child categories under the parent.

Also, on my results page, I’ve set it up so that it says “search results for [search term]”. But the results from this plugin come up as “search results for advanced”, no matter what the search term was.

Any thoughts on how to change either of those?

Alex Günsche am 9. Oktober 2006 um 15:30 #

Hi Jo,

I’ve installed the plugin and it seems to be working ok (1000+ posts) though I’d prefer it if the categories were listed in the same way as I list them in the sidebar: alphabetically and with the child categories under the parent.

Good news: Both features are in development and planned for the next release. :-)

Also, on my results page, I’ve set it up so that it says “search results for [search term]â€. But the results from this plugin come up as “search results for advancedâ€, no matter what the search term was.

Yes, I know. This is also a thing I’m working on.

Jo am 9. Oktober 2006 um 18:02 #

Cool :)

http://irregulartimes.com/ am 10. Oktober 2006 um 14:09 #

Advanced Search Added to Irregular Times…

For a few years, Irregular Times has had a simple text search box available, but because we have written nearly 3,000 blog entries the sheer number of results often turns out to be unreasonably large. For more focused searching, we have added an advan…

SG am 16. Oktober 2006 um 15:16 #

Alex, it shows only 4 categories for me. I installed it as it said. My advanced Search page.

I want an option to include it’s php code in the sidebar so that it shows up the sidebar.

As Jo stated I also want it to show all Categories and Subcategories in a tree like format with alphabetical sorting of the Categories. Thanks.

SG am 16. Oktober 2006 um 15:19 #

Also I want it to hide empty categories or subcategories and show the no of posts count next to Category or Subcategory name. Thanks.

SG am 16. Oktober 2006 um 15:34 #

Sorry this is the third request:

An option to select or deselect all categories and subcategories. This will be very useful to if I want to check only a few categories and search in them. Otherwise I have to search only in 1 or 2 categories, I have to manually deselect all the other Categories which are 130 in number which is too much work.

An option that when I check one category, all subcategories in that parent Category should get checked. This will allow me to search very easily in all the posts in one specific category which has many subcategories. My parent category normally does not have any posts and I think it is the same for many others. Thanks.

Alex Günsche am 16. Oktober 2006 um 16:57 #

Hello Swami (SG),

The plugin actually offers your requirements for the category output (with some settings changed in the call to the function ctas_form_cats()).

For your more specific requests, I answered to the mail you sent me.

Jeremy am 29. Oktober 2006 um 17:34 #

Hey Alex,

I really love the Advanced Search plugin. However, after upgrading it this morning, it stopped working properly. The advanced search page turns up just fine, with everything in place (http://www.axesandalleys.com/aa-advanced-search/), but when I perform a search, no results come up on the page, just a big blank area with nothing in it. Any thoughts?

Alex Günsche am 29. Oktober 2006 um 19:58 #

Hi Jeremy,

I can not reproduce your problem. A search for sport for example does return results on your site. What is true is that an unsuccessful search returns a blank page. But this is not a matter with the plugin, but rather your search.php.

Jeremy am 29. Oktober 2006 um 20:23 #

Thanks for the quick turnaround Alex. I must have either been putting in unsuccessful terms or fixed something with the site that was affecting Advanced Search in the past couple of hours. It’s working just fine right now. Love the new highlighted terms. Thanks!

Rub3X am 31. Oktober 2006 um 00:25 #

Whenever I search the comments it has an SQL error..here is an example

Alex Günsche am 31. Oktober 2006 um 00:33 #

Oh my… I realize there is a snippet of code which I forgot to remove after playing around. Please remove line 426 (the line with WITH QUERY EXPANSION) in the plugin file and try again.

If that doesn’t solve the problem, which is your MySQL version?

Rub3X am 31. Oktober 2006 um 05:17 #

That worked. Sorry about breaking your theme I figured it would auto truncate the URL. You should get the plugin to make it do that ;)

Alex Günsche am 31. Oktober 2006 um 10:13 #

That worked.

Fine. I can imagine you’ll not be the only one with this problem. (Although it does work with others.)

Sorry about breaking your theme I figured it would auto truncate the URL. You should get the plugin to make it do that

Nevermind, I edited you comment before approving anyway. But you’re right, such a plugin would make sense. Unfortunately, I didn’t come accross such a plugin yet.

Marcus Schultz-Bergin am 15. November 2006 um 01:44 #

Hello,

Thanks for the plugin, but I am having trouble trying to figure out how to edit the look of the search page. The method for establishing the look of the page is different then what I am used to. I was wondering if there are any instructions somewhere they will aid in editing the output.

Thanks

Alex Günsche am 15. November 2006 um 11:34 #

Hello Marcus,

could you please explain, what exactly you are trying to do? Are you trying to create a template or do you have trouble with the CSS?

Marcus Schultz-Bergin am 16. November 2006 um 00:27 #

Hello Alex,

I am fine with both CSS and WP template creation, my issue is getting the search to look different in its output. For instance, in the links above to see the advanced search in action, the last one is for BballCity and you even mention that it is “lightweight”, etc. I would like to set up something like that… but when I look in the php file for the advanced search you don’t have one specific section for the output, but instead output different parts all over the file.
I am just having a hard time comparing the output (on my webpage) with the code, since its not centrally located.

On a slightly related note, perhaps you could start putting out ’search templates’ to change the way it looks without the user having to do much. But I am totally willing to change my search myself, if only I could come to terms with the php file.

Alex Günsche am 16. November 2006 um 08:10 #

you don’t have one specific section for the output, but instead output different parts all over the file.

Apparently, it’s too obvious. ;-) There is the function ctas_form() at the very top of the plugin file which cumulates a set of other functions to compose the search form.

As I wrote in the Advanced Howto, you can create a new template and use the contents of ctas_form() to exactly reproduce the search form on this template page. If you want to exclude sections, you can simply remove the according function (and possibly some HTML chunks). This is the way to go, and this is the way it has been done on Bbcity and a couple of other pages.

I think this should also answer your “related note”. ;-)

Phil am 21. November 2006 um 02:01 #

first, thanks for your work. Hi have wordpress 2.0.5 with the default theme and I follow the procedure but when I go to the advanced search page…it’s blank. Any idee?

Phil

Phil am 21. November 2006 um 03:46 #

Sorry, I don’t know why but now that work. :)

goxu am 24. November 2006 um 13:14 #

Hi,

I’ts so cool plugin.

I’m wodering if it is only me to get 0 results and redirected to the index when searching by ‘php.’ Does others also have this problem?

pavonic am 24. November 2006 um 15:18 #

Hi,

I’m using WP 2.05 with polyglot plugin. This plugin change the WP locale dinamically by user request.

I had to make the following changes to your plugin so that the related .mo file inside /advancedsearch/ln10/ got loaded corrispondently.

1)
I moved the load_plugin_textdomain() call inside and on top of the ctas_init() function.

2)
I replaced the WP_LANG defines used in the ctas_hintpopup() with the global $locale variable.

Thanks for your great plugin!
Cristian

Alex Günsche am 24. November 2006 um 17:23 #

goxu,

a unsuccessful search can have various reasons. One can be that your language doesn’t have word boundaries such as blanks or commas. These characters are needed by MySQL to recognize the words within a search query. Another reason for failure are too short search term. By default, MySQL ignores words with three letters and less in order to improve performance. One can change this setting, but this requires access to the server’s MySQL configuration.

Christian,

that sounds interesting. I also use the Polyglot plugin, and I solved the problem by (a) adding the translations to my global language file and (b) determining the current language via $polyglot_settings['lang_pref']. Using the $locale variable is a great idea; I thank you for your enlightenment, and I’ll include it in the next release.

However, I was not able to reproduce the load_plugin_textdomain() hack. I have to admit that it doesn’t make sense to me, as the function is executed anyway when the file is loaded. Could you please give me some more details on how to achieve this? I really love Polyglot, and I would love to see both plugins working together “out of the box”. Correction: It does work! My mistake was that I had deleted the the reference to the plugin’s language file as I wanted to use the global one. Now it works perfect, thank you very much!

clare am 28. November 2006 um 03:27 #

Thank you for the great plugin - I was wondering if it was possible to customise this even further and search through custom fields as well.

Alex Günsche am 28. November 2006 um 11:28 #

This is definitely a good idea, but the problem is the database structure of the wp_postmeta table (when it comes to custom fields). The custom fields are not arranged in a row, but their values are spread over multiple rows inside one column. While this surely makes sense for the usual duties of this data, it is — due to the nature of the SQL queries — virtually impossible (or at least ) to integrate this into a search, especially a MySQL fulltext search.

clare am 28. November 2006 um 18:38 #

I see what you’re saying. This is a pity.

Perhaps a separate search function would work to search only the meta keys.

manuel am 8. Dezember 2006 um 10:10 #

Hi, thanks it is a great plugin.
I would like to ask you if will be any way to use it with wordpress mu (multy user). I’m looking for a pluging or hack to have the possibily to make search across a blog comunity using tags too. Any clues will be wellcome, Thanks. Can I use avanced search for this?
Thanks again for your work

Alex Günsche am 8. Dezember 2006 um 15:00 #

Hi manuel,

I think it would be technically possible with some effort, but I have to admit that I haven’t occupied too much with WPµ so far. I could do an implementation, but… well, that would be far beyond free support. ;-)

Rose Kane am 13. Dezember 2006 um 22:26 #

Guten Abend Alex,

eine Frage: Die normale Suchfunktion von WP findet keine statischen Seiten (Pages). Kann das dein Plugin? Bzw. findet dein Plugin beides (stat. Seiten & nichtstat. -> Blogbeiträge/Kategorien)?

Danke für die Auskunft.

LG
R.K.

Vroomfogle am 14. Dezember 2006 um 00:39 #

Hi,

I seem to be having some problems performing a search. I get a WP error like this:

WordPress database error: [You have an error in your SQL syntax near ‘BOOLEAN MODE ) AND post_date_gmt

Alex Günsche am 14. Dezember 2006 um 00:55 #

Rose Kane,

ja… das Plugin findet einfach ALLES! :-P

Vroomfogle,

this error indicates that you have a MySQL version older than 4.0, which means that it hasn’t boolean mode implemented. If you want, you can remove the words IN BOOLEAN MODE from the SQL code in the plugin file. This will result in a different search behaviour considering the results and the ranking, but it will at least allow you to use the Advanced Search. Alternatively, upgrade to a newer MySQL version.

Rose Kane am 14. Dezember 2006 um 03:22 #

Alex, okay, dann werde ich das doch glatt mal die Tage testen. );°) Ich berichte dann …

LG
R.K.

Vroomfogle am 20. Dezember 2006 um 03:21 #

Alex - thanks. I upgraded and things work as expected now, except one issue.

I’m actually running my own plugin to do sorting by custom fields. It uses the posts_join and posts orderby filters. I’m also running a plugin to split results among multiple pages. Well, these plugins aren’t working nicely with the advanced search. Specifically I would like Advanced Search to return all results without breaking into pages itself so pagenavi can deal with it. Secondly, I’d like retain my ordering. Any idea what/where I may need to modify to get these plugins working together?

Another problem is that the category list is truncated in the search form. There’s no scroll bar to look through all categories, just the top several categories can be seen. Any suggestions?

Thanks!

Alex Günsche am 20. Dezember 2006 um 12:27 #

Hi,

I’m actually running my own plugin to do sorting by custom fields. It uses the posts_join and posts orderby filters. I’m also running a plugin to split results among multiple pages. Well, these plugins aren’t working nicely with the advanced search.

Yes, that’s an unfortunate, yet expectable issue. The Advanced Search uses a special query syntax and is inserted via the very early posts_request API filter, while the WordPress filters for your plugins only modify the already inserted query. Thus, conflicts are very likely.

Specifically I would like Advanced Search to return all results without breaking into pages itself so pagenavi can deal with it.

This is no problem, you just need to remove the LIMIT parameter from the SQL query.

Secondly, I’d like retain my ordering.

I don’t know if I got you right… The Advanced Search can return results ordered by relevance score related to the search terms, and it can order by timestamp (both ascending or descending). Your visitors can set these parameters at the bottom of the search form, and you can change the default presets in the plugin file. You could even choose a different field to sort by (in the SQL query), provided it is in the wp_posts table.

Another problem is that the category list is truncated in the search form.

This is a problem which appears to be caused by another plugin (see comment #12 on this page). I’d suggest to do the good ole try’n'error to determine the blocker and have a look what in this plugin might cause the trouble.

Vroomfogle am 20. Dezember 2006 um 14:46 #

Alex, thanks for the info again. What I mean about ordering is that I’m ordering my custom fields. My ‘blog’ actually doesn’t use time at all, it uses only custom fields to order by (it’s a timeline for a fictitious world). So I actually don’t want to sort by relevance OR chronologically. I just want it to return all results so I can then sort by custom fields (i’m using usermeta plugin which utilizes a separate table).

I’ll play with my plugins. I suspect fold_category_list to be the culprit.

Alex Günsche am 21. Dezember 2006 um 15:10 #

I just want it to return all results so I can then sort by custom fields (i’m using usermeta plugin which utilizes a separate table).

I’m afraid, in this case the only solution would be to hack another INNER JOIN on the respective table into the plugin’s SQL and adapt the form elements accordingly.

Rirath am 25. Dezember 2006 um 01:13 #

I’ll be using this just as soon as it includes support for tags and meta-info. Otherwise, looks great. I’m assuming it’s possible to show just the search form and hide all the advance options, to seamlessly replace the default search.

Alex Günsche am 26. Dezember 2006 um 13:12 #

I’m assuming it’s possible to show just the search form and hide all the advance options, to seamlessly replace the default search.

You can achieve this by taking the ready form and inserting hidden input fields with your presets. For hints on composing custom search forms, please see the advanced tutorial.

Nobbi am 26. Dezember 2006 um 21:53 #

Hi Alex,

ich möchte nicht versäumen, zur Info auch zwei Seiten zu nennen, bei denen Advanced Search in der aktuellen Version 0.4 läuft:
http://www.webnobbi.de (oder .eu *g*)
http://www.pro-goch.de

Seeehr schönes Plugin und auch das Update ging absolut problemlos über die Bühne :-) .

Marco am 3. Januar 2007 um 14:28 #

Hi,
I’ve tried ypur plugin but features
“Allows limiting the search to one or more categories”
do not works…
I’ve tried on “advanced search” your site but do not works…
Regards Marco

Alex Günsche am 3. Januar 2007 um 15:44 #

Hi Marco,

could you please describe your problem a bit more specifically? What did you try, what happened, and what would you have expected?

And could you please give me a link to your website?

Marco am 3. Januar 2007 um 15:54 #

Hi Alex…
example: in your site go to advanced search http://www.zirona.com/erweiterte-suche/ and in search query insert Herbert Hanewinkel …select only category Meinung and exclude other categories.. after try to search.

If I exclude category software and Wissenswertes post “Encrypted contact forms for WordPress” is visible. Do you understand?
Thanks

Christophe am 4. Januar 2007 um 16:26 #

Tolles Ding, nur ich finde im Quelltext nicht, wie man das Ding in der Breite anpassen kann. Es sprengt mein Layout total.

Wie ändere ich das?

Alex Günsche am 5. Januar 2007 um 19:25 #

Hello Marco,

that’s weird indeed. I have to check whether this is a new error in version 0.4. or if it has to do with my site (as I have imported posts from another blog, which might have messed up my installation).

Christophe,

das sollte eigentlich alles wunderbar mit CSS gehen.

Marco am 6. Januar 2007 um 00:37 #

I’ve same problem on my site.
I have imported posts from feed rss and advanced-search by categories do not works correctly

Mr Papa am 6. Januar 2007 um 05:05 #

Hello,

When searching, the plugin asks for the number of results to display on each page. This does not seem to be working for me…

I always get the number of posts displayed equal to the option in the wp admin for posts to show on a page…

For some of my template pages, I can bypass this with query_posts($query_string . ‘&showposts=25′) right before the loop to “reset” the number of posts displayed (useful on my archives pages).

Is there any way for me to actually let your plugin determin how many posts to show?

Thanks…

Mr Papa

Alex Günsche am 6. Januar 2007 um 17:36 #

If your template uses query_posts(), then it’s written badly. A theme should always have a proper Loop, query_posts() is just for additional loops. I’m afraid I can’t really help you with this, you should possibly ask the theme’s author to fix the templates.

Mr Papa am 6. Januar 2007 um 18:13 #

I probably wasnt clear… or perhaps there is another way… or I am just missing something… the loop displays posts in a paged manner based on the number of posts per page to display set up in the wp admin… in some specialized pages that I have, I dont want that limit as I may be only displaying titles or authors or such… my fix on those specialized pages was to use the query_posts() right before the loop to reset the number of items displayed…

is there another way to control the number of posts displayed per page so that it can be different on different pages?

Also, how do I get the number of search results selected in your plugin to actually get displayed since wp is auto paging it with the number of posts per page in the wp admin and your option number appears to be ignored?

Thanks Alex!

Mr Papa

Alex Günsche am 8. Januar 2007 um 01:17 #

Hi,

ok, I’m starting to understand your configuration. ;-)

I actually do know that query_posts() has this behaviour to change the number of posts if it is called before the main Loop. I still have to say that this is a pretty ugly hack, if you know what I mean. There are many other ways to influence the number of posts; for example you could use an iterator and break out of the Loop at a certain point.

However, your description makes me assume that you don’t have a search.php in your theme. Maybe you could create such a Template page and construct it with a proper Loop and without query_posts(). Then the Advanced Seach plugin could take care of the number of posts displayed.

Does this bring you any further or did I get it all wrong again?

Mr Papa am 8. Januar 2007 um 04:54 #

Thanks for replying Alex… yes, I agree its ugly and only using in a couple of odd spots :wink: hoping to find some different workarounds…

no, I dont have a search.php - not really familiar with that… guess its time to get familiar :woot:

let me do some research and see if that helps me out…

thanks…

Mr Papa

markww am 11. Januar 2007 um 06:19 #

Hi,

Two questions:

1) I tried downloading the zip to my XP machine for unzipping, but I get an error saying the zip is corrupt.

2) Will this work with the latest release of wordpress?

Thanks for what looks to be a great plugin,

Mark

cj am 11. Januar 2007 um 08:51 #

Hi Alex,

Great Plugin! Thanks for the hard work.

I found a few issues in version 0.4 that I have resolved locally. I wanted to pass my changes back to you for review.

problem: category filters not applied
I checked the resulting SQL string and found ‘OR (1=1)’ appended to the category qualifier. I traced this to advancedsearch.php line 427. I suppose the author filtering is still being developed (I don’t see any UI for it…). My workaround was to comment lines 415 to 432 and add an extra closing parentheses to line 411.

problem: date qualifier was inaccurate
I checked the resulting SQL string and found an extra date qualifier. I traced this to advancedsearch.php line 482. My workaround was to comment that line.

Thanks again,

cj

Alex Günsche am 12. Januar 2007 um 12:58 #

Hello markww,

1) I tried downloading the zip to my XP machine for unzipping, but I get an error saying the zip is corrupt.

Some Windows unzipping applications are known to have this behaviour. Please try 7zip, its an advanced packaging solution and it’s Open Source.

2) Will this work with the latest release of wordpress?

It runs on WordPress 2.0.6 on this very website and I have developed the 0.4 release on WP 2.1 alpha3 from SVN. So it’s supposed to work on the upcoming 2.1 release, too.

Alex Günsche am 12. Januar 2007 um 13:15 #

Hello cj,

Great Plugin! Thanks for the hard work.

You’re welcome. Glad you like it. :-)

I found a few issues in version 0.4 that I have resolved locally. I wanted to pass my changes back to you for review.
problem: category filters not applied
I checked the resulting SQL string and found ‘OR (1=1)’ appended to the category qualifier. I traced this to advancedsearch.php line 427.

Thank you very much for tracing the problem. It appears to be the same issue that Marco (comment #48 on this page) mentions. I didn’t have the time yet to have a look and fix it.

It must be a new one in 0.4, as it did work before. Unfortunately, I didn’t test this feature before the release, because I made only small changes to the SQL query construction and assumed it would work. Shame on me. :-(

I suppose the author filtering is still being developed (I don’t see any UI for it…).

Yes, there is an author filtering. It even works, in opposite to the category filtering (just tested). ;-) The reason why you don’t see the UI on your site might be that you have only one author who has written posts so far. In this case, the author selection field is suppressed. The same applies to the category selection. And if you only have one category and one author (e.g. on a fresh install), the entire “from” fieldset is hidden.

problem: date qualifier was inaccurate
I checked the resulting SQL string and found an extra date qualifier. I traced this to advancedsearch.php line 482. My workaround was to comment that line.

Good to know. Thank you for this one, too. I’ll have a look and fix it.

Well, today I got sent Italian translations for the plugin, and along with your fixes, this is good reason for the soon release of a new version. :-D

markww am 12. Januar 2007 um 16:42 #

Thank you very much Alex.

Eric Fields am 16. Januar 2007 um 17:45 #

This worked beautifully on one WP site I have. I’m trying to get it going on another site and it’s not working at all; i just get the ‘no results’ screen for anything i search for. This site uses the K2 theme, which has an ajaxy search in the sidebar that shows you the results without reloading. I was thinking this was the problem, but i switched to another theme and still no results.

Anyone know what I can do to further test this?

Marcel am 17. Januar 2007 um 16:14 #

I’m using the andreas01 theme and want to use the advanced search. But the version 0.5 doesn’t work with wordpress 2.0.7 for pages. I tried also the standard theme from wordpress.
The fulltext index is created and a search on the mysql shell succeeded but I only find posts no pages. The highliting is working. But there are no results from pages.
What do I wrong?

Alex Günsche am 18. Januar 2007 um 12:02 #

Hello Eric and Marcel,

Eric, could you please try deactivating other plugins and check if it works without them?

Marcel, I’m sorry, I can’t reproduce this on my site. Can you please give me a link to your site and describe how I can reproduce it?

Marcel am 18. Januar 2007 um 19:04 #

Hi Alex,

I’m not sure what happend but now it seems to work with one exception.
Try Footnote. Click on Search and enter “Bayo” as search string. You will get several results. In the footer of every hit it appears the post date and the category. All pages are categorized into “Uncategorized”(I’ve renamed it to “Chess”). Is this a correct behaviour?
Real blog posts will show the correct category.

Alex Günsche am 19. Januar 2007 um 16:00 #

Yes, this is a normal behaviour. Pages in WordPress belong to the default category, hence your search template makes this output appear. You would experience the same behaviour with other page searching plugins.

Dennis am 20. Januar 2007 um 16:20 #

Alex -

The zip download is not working for me. I get the message from winzip that it is not a valid archive. Could you check it out, maybe it is just me.

Thanks - Dennis

Alex Günsche am 20. Januar 2007 um 16:28 #

No, it’s not you, it’s WinZip. ;-)
Please try with 7zip, this one is better (and btw Free Software).

Dennis am 20. Januar 2007 um 16:46 #

Worked perfectly. Thanks!

Dennis am 21. Januar 2007 um 11:10 #

Alex - Again thanks for the plugin. I have it up an running. It works great with all posts that were written before installation of Advanced Search, but it is not returning results for post written after installation. I’ve read through the comments here and did not find any mention of this. The the standard WP-Search does return the correct results for the same queries on new posts.

Any ideas of the top of your head?

Dennis am 21. Januar 2007 um 13:24 #

Alex - Regarding message #72 above. When I go to a post that I have just written and manually reset the post timestamp to one day earlier (or any earlier date), Advanced Search will then return it correctly in results.

Could this be an issue with the query Advanced Search is using to search the wp database for posts?

hansi am 23. Januar 2007 um 19:28 #

hi, ich habe das plugin hochgeladen und aktiviert aber irgendwie zeigt es mir auf der seite keine kategorien an.

Alex Günsche am 23. Januar 2007 um 20:05 #

Also ich sehe auf der genannten Seite jede Menge Kategorien.

hansi am 24. Januar 2007 um 08:30 #

ups, hab auch gesehen es liegt an der schriftfarbe, die ist auch weiß deswegen sehich die nicht

Jesse am 24. Januar 2007 um 16:50 #

I’m a n00b, what do you mean with ad the content in
Create a new page with the title “Advanced Search†(or whatever you like), and the content

Alex Günsche am 24. Januar 2007 um 17:03 #

You simply go to Write -> Page in your admin panel. Then you insert the title “Advanced Search” (or something different). Then you you add nothing but the code <!–advancedsearch–> in the content area. After that, you simply safe/publish the page. When you visit the newly created page on your blog, you will see the Advanced Search form.

Jeff am 27. Januar 2007 um 09:14 #

Hi,

Would really love to see a Widget version of this plugin, so it can be seen as a small widget in the sidebar with options of simple and advanced search…and it can be added into sidebar just by drag and drop as like other widgets.

Alex Günsche am 30. Januar 2007 um 17:57 #

Jeff, I already considered this, and I decided not to “widgetize” this plugin. This is because the search form consists of so many elements that you nevertheless would have to edit the code in order to select a subset of them, which again would make it easier to directly insert the code into your sidebar.

catzy am 1. Februar 2007 um 16:42 #

Everything done per your instructions, yet when i click on my Advanced Search page, i get a 404 error. Any ideas? Thanks. Staci

Alex Günsche am 1. Februar 2007 um 16:44 #

catzy, please give me a link to your website, so I can have a look.

catzy am 1. Februar 2007 um 16:50 #

i wish i could, it’s on an intranet.

Alex Günsche am 1. Februar 2007 um 19:57 #

Could you please go to Manage -> Pages in your control panel, and click View beneath the AdvancedSearch page. Does this also give a 404?

Aza am 2. Februar 2007 um 19:40 #

Thanks for this great plugin! It’s certainly the best search available for WP.
I’ve just installed it on my test server (Ubuntu LAMP on an old PC) where I’m trying to configure WP as a simple mini-CMS. It’s a pure WP 2.1 - not updated from previous versions and I think they may have changed the wpdb() or the database format a bit as I have some problems:
1. Searching comments produces only 1 result even if all 3 checkboxes are checked (search in posts, pages and comments).
2. Only the first results page is displayed.
The only active plugins are Paged Comments and Recent Comments, but deactivating them doesn’t fix anything.

I’d also strongly recommend to everyone to make a search.php template for his/hers main theme (if it doesn’t have one) as that makes the display of search results a lot better and highly customizable.

For that template to work right the main form action has to be changed from: $_SERVER['PHP_SELF'] to: bloginfo('home');
Otherwise WP 2.1 doesn’t load the search.php every time…

Sadalwantar am 7. Februar 2007 um 17:10 #

auf meinem testblog (WPD2.1) mit statischer Home-Seite (-habe das aber auch ohne probiert-) habe ich mal das AS 0.5 installiert und mit den Standardartikeln versucht, einige Suchen nachzuvollziehen. Dabei stellte sich heraus, dass das Plugin unter WP 2.1 wohl nicht richtig mit Seiten bzw. auch mit Kommentaren arbeitet…

siehe: http://www.midgardr.de/_devarea_/A0001.b/

wo liegt das problem?
(also ähnlich dem von #85 / Aza, nur dass halt ausschließlich Blogartikel durchsucht werden)

frank am 7. Februar 2007 um 18:09 #

Hi Alex!
Ich hab nach 0.3 die 0.5 installiert, nachdem ich auf WP 2.1 geupdated habe…
Wenn Du die Seite Suchen im o. g. Link benutzt, siehst Du Merkwürdiges…
1. kennt die Suchergebnisseite keine deutschen Umlaute mehr…
(außer im letzten von mir geschriebenen Beitrag nach Umstellung auf WP 2.1… könnte also ein WP 2.1 Problem sein)
2. schreibt sie weitere Suchergebnisse aus unerfindlichen Gründen unterhalb des eigentlichen contents…

ist das Umschreiben der action wie im Kommentar von Aza benannt eine Lösung…?

oder sitzt Du bereits eh an Version 0.6?

Alle Treffer in Beiträgen sollten doch schon richtig untereinander angezeigt werden.

LG Frank

Nathan am 12. Februar 2007 um 04:37 #

Hello,

I’m trying to get this plugin to work on a site I’m building: http://pittsburghdrinkspecials.com/advanced-search/

Whenever I search I can’t seem to bring up any results, though. Any ideas?

Thanks in advance for any help you can throw my way!

woomera am 15. Februar 2007 um 17:02 #

Nice plug-in.thanks.
but can anyone tell me how can i remove the translation from the plug-in?

Roger am 15. Februar 2007 um 19:19 #

That’s funny, I actually want the translation to work, but woomera wants to get rid of it? Anywayz, I can’t get the plugin to work in another language. There are localized versions included in the package, I followed the instructions and uploaded all files correctly, but how do you specify the language to be used?

Alex Günsche am 16. Februar 2007 um 18:03 #

woomera, I don’t know what you mean, but maybe you have a wrong setting for WPLANG in the wp-config.php file. If in doubt, it should be sufficient to delete the language files in l10n.

Roger, the language to be used is defined in the WPLANG constant in your wp_config.php file.

Gunnar am 18. Februar 2007 um 06:45 #

Hi Alex,

Das PlugIn ist genau das, wonach ich schon länger gesucht habe. Nur (WP2.1) ich hab die selben Probleme wie Frank (Eintrag 83) und die anderen Wordpress 2.1-User - Auch bei mir gibt’s eine Fehlermeldung bei der Eingabe von Suchbegriffen mit Umlauten, und zwar:

“Warning: Unknown modifier ‘2′ in /home/ …. /wp-content/plugins/advancedsearch/advancedsearch.php on line 545″

Dann hab ich ebenfalls immer nur eine Ergebnis-Seite … und nichts zum “Blättern” …

Ein bisschen probiert hab ich natürlich selbst schon: Wordpress 2.1 unterscheidet zwischen “Pages” und “Posts” ja nicht mehr mit den Werten in “post_status”, sondern mit den Werten in (neu) “post_type” - Die Suche findet grundsätzlich keine Ergebnisse auf Pages - bis jetzt war ich (noch) erfolglos, aber ich bleib dran. Nur “meckern” macht ja keinen Spaß.

:-)

Letzter Punkt (Eher unwichtig und nur zufällig bemerkt, weil ich von der Tastatur abgerutscht bin) - Bei leer abgeschickten Such-Anfragen gibt’s eine Meldung “You have an error in your SQL syntax …” Das dürfte aber leicht abzufangen sein, schätze ich.

Datt war’s soweit - Dank Dir für die Arbeit und viele Grüße,

Gunnar

Alex Günsche am 18. Februar 2007 um 11:35 #

Hallo Gunnar,

es tut mir sehr Leid, dass bereits mehrere Benutzer diese Fehler gemeldet haben, aber es noch keine neue Version gibt. Ich habe leider momentan sehr viel zu tun, daher bleiben die Plugins ein bissel auf der Strecke. Aber das AdvancedSearch-Plugin ist gerade in Bearbeitung, die meisten der gemeldeten Fehler habe ich schon behoben.

Das PlugIn ist genau das, wonach ich schon länger gesucht habe. Nur (WP2.1) ich hab die selben Probleme wie Frank (Eintrag 83) und die anderen Wordpress 2.1-User - Auch bei mir gibt’s eine Fehlermeldung bei der Eingabe von Suchbegriffen mit Umlauten, und zwar:
“Warning: Unknown modifier ‘2′ in /home/ …. /wp-content/plugins/advancedsearch/advancedsearch.php on line 545″

Ich habe eine Ahnung, woher das kommt, hängt vermutlich mit dem “clean-umlauts”-Plugin zusammen.

Dann hab ich ebenfalls immer nur eine Ergebnis-Seite … und nichts zum “Blättern†…

Das ist ein sehr seltsames Problem mit WP 2.1, das ich momentan untersuche und mir derzeit eigentlich die meisten Nerven raubt.

Ein bisschen probiert hab ich natürlich selbst schon: Wordpress 2.1 unterscheidet zwischen “Pages†und “Posts†ja nicht mehr mit den Werten in “post_statusâ€, sondern mit den Werten in (neu) “post_type†- Die Suche findet grundsätzlich keine Ergebnisse auf Pages - bis jetzt war ich (noch) erfolglos, aber ich bleib dran. Nur “meckern†macht ja keinen Spaß.

Das Problem habe ich mittlerweile mit einer Versionsabfrage und -weiche gelöst, da ich mit dem Plugin abwärtskompatibel bleiben möchte. Besonders elegant ist das nicht, aber es funktioniert.

Letzter Punkt (Eher unwichtig und nur zufällig bemerkt, weil ich von der Tastatur abgerutscht bin) - Bei leer abgeschickten Such-Anfragen gibt’s eine Meldung “You have an error in your SQL syntax …†Das dürfte aber leicht abzufangen sein, schätze ich.

Das ist höchst seltsam und keineswegs unwichtig, denn es könnte bedeuten, dass man SQL einschleusen kann. Allerdings kann ich das bei mir nicht reproduzieren, hab es auch sonst noch nirgends gesehen und wüsste momentan auch nicht, an welcher Stelle es entsteht. Könnte es mit einem Deiner anderen Plugins zusammenhängen? Kannst evtl. Du das Problem reproduzieren und mir die exakte Fehlermeldung per Mail schicken?

Gunnar am 19. Februar 2007 um 04:52 #

Hallo Alex,

vielen Dank für den guten Support - und die Ursache für den MySQL-Error hat nichts mit Deinem PlugIn zu tun, das lag an ein paar Eigenbau-Funktionen der Test-Seite, an der ich grade arbeite (Siehe E-Mail) …

:-)

Nathan am 21. Februar 2007 um 21:09 #

Hey Alex,

This is a super cool plugin and great work btw!

I was just wondering if you would know why the categories aren’t showing up in mine?

I have multiple categories and I tried messing around in the plugin itself (and managed to get From the Categories to show… :)

But I’m really no PHP wiz so I can’t do much on my own.

Any help would be greatly appreciated!

Alex Günsche am 24. Februar 2007 um 14:15 #

Nathan, I don’t know. Maybe you should try with an out-of-the-box version, and then report possible errors you get with this one.

Gyanguru am 28. Februar 2007 um 05:10 #

Thas was a great Plugin from you I was searching for it for mroe than a month

Simon am 28. Februar 2007 um 15:43 #

Hi Alex,

Thanks for all your effort on this, it’s a really great plugin.

One question - is it possible to display truncated search results, showing the highlighted search term in context? I have some large pages on the site I’m developing, and when searching for a term within the page, the entire page is displayed in the search results. What I’d really like is for the results to be more like this, if I search for the word ‘context’:

Page 2
…here is the search term in context, rather than displaying the whole page…

that is, the search term surrounded by x words (or x characters) on either side.

Alex Günsche am 1. März 2007 um 08:36 #

Simon, this really sounds interesting. The thing is, this is actually something that appears to not belong into the AdvancedSearch plugin itself (at least to me). But I’ll keep it in mind and I’ll check if and how it could be implemented, maybe as a standalone plugin.

Besides, as the AdvancedSearch searches for words and usually matches more than one position in the text, it might also need to output more than one result “chunks”. This idea might be more suitable for the legacy WordPress search, which finds exactly one string in each result.

Ananda am 5. März 2007 um 12:56 #

@ Simon (#98)

One of the solutions similar to this in one of the themes I use is to add the rss summary info to the search.php file for the theme.

Add the code:


<?php the_excerpt_rss(); ?>

below the search results. It’s not nearly as nice as having the actual search term in those few sentences, but it does help the reader a little bit.

Ananda am 5. März 2007 um 13:01 #

Alex,

This is a great plugin! I’m still playing around with it on my test machine, and one of the things I’m also testing out is a plugin called “Now Reading.”

It’s probably not in your interest to develop this, but I was wondering how one would go about including the “Now Reading” content in the search results. Now Reading adds its own tables to the WP Database…. If you can take a look at the plugin and give me some pointers on where to start, that would be great.

Thanks!

~ Ananda

Chris Hunt am 5. März 2007 um 13:48 #

There’s a plugin called Search Excerpt - http://fucoder.com/code/search-excerpt/ - which, erm, makes a nice excerpt of the matched page with the matched text highlighted. I’m not using your search plugin (yet) so I don’t know if the two work together, but if not you may be able to make something of their code.

Alex Günsche am 5. März 2007 um 14:10 #

Ananda, you would need to do a SQL JOIN on the other tables in order to include search results from them. I recommend that you do testing on the MySQL command line first, which is much better for developing MySQL queries. Once you’ve got the result you desired, you can incorporate it into the SQL statement in the plugin file.

Chris, the AdvancedSearch does highlighting, too. The highlighting function of the Search Excerpt plugin will certainly not work properly with AdvancedSearch results, because the latter uses a different logic (see above in the plugin description). As for the nicer excerpt, if the plugin hooks into one of the the_excerpt or the_content filters, it might work.

coyotech am 7. März 2007 um 01:35 #

I really need some help all im trying to do is get this to replace the deflaut search form. That advance tutorial pretty vague I looked and still I’m lost.

Alex Günsche am 7. März 2007 um 01:55 #

I really need some help all im trying to do is get this to replace the deflaut search form.

If you have patience for some few more days, there will be an “AdvancedSearch Lite” which will be a drop-in replacement for the legacy WP search.

Tedinoz am 7. März 2007 um 13:06 #

Hi

Plugin installed, but maybe I misunderstand how plugin works. BTW running 0.6 on WP2.05 and FireFox 1.5.0.9. & IE7

I thought that I should be able to put a phrase in quotes (such as “HMAS Australia”) and that the plugin would return all the relevant posts. In fact, it returns none. Search HMAS Australia (no quotes) and it returns 2,300-odd (which is about right because it has every post with the word HMAS OR Australia in it). Search “HMAS Australia (leading quote only-did this by accident!) and it returns relevant posts but from one category only(when all were ticked); trailing quote only brings posts from another category only.

OK, now the weird one, when I run the leading or trailing quote in IE7, it returns 2,300 posts.

Am I on the right track about phrases?

The search page is hidden from the menu and site map until working right, so let me know if you want to try it.

Thanks

Ted

Alex Günsche am 7. März 2007 um 19:38 #

Yes, a link to your search page would be helpful.

Tedinoz am 9. März 2007 um 04:58 #

Of course, I should have included it the first time round.
http://www.navyhistory.org.au/pages-to-be-held-back/advanced-search/
Ted

carl am 11. März 2007 um 23:26 #

what exactelly am i suppose to include when you say “<!–advancedsearch–>”? thanks in advance!

Alex Günsche am 12. März 2007 um 09:37 #

Create a new page, insert this piece of code, save the page.

Btw: next time, please don’t write 4 comments at once, or I’ll have to feed you to Akismet.

crybaby am 12. März 2007 um 15:17 #

ok captain, however it would be nice to actually be able to post CODE in the code brackets.

also, i have “installed” the plugin writen a bunch of new pages inserted the “code” in many different ways and it doesnt show anything exept this “comment” i HTML-source. so, is there anything else i need for this plugin to work? im using the latest WP download on localhost..

thanks in advance. sorry for spamming..

Alex Günsche am 12. März 2007 um 15:54 #

ok captain, however it would be nice to actually be able to post CODE in the code brackets.

Yeah, maybe. But WordPress doesn’t convert the tags automatically. Btw, note that you can always edit your code for 30 minutes after posting, i.e. you didn’t need to write three other posts.

also, i have “installed†the plugin writen a bunch of new pages inserted the “code†in many different ways and it doesnt show anything exept this “comment†i HTML-source. so, is there anything else i need for this plugin to work? im using the latest WP download on localhost.

No, it’s nothing but entering this “conditional” comment and saving the page. If you had it online somewhere, I could have a look at it. But this way, I can’t really help you but suggesting to try again.

psycentr am 13. März 2007 um 22:14 #

First, I love this advanced search. Love it. But I’m having a formatting problem - without messing around the code, this is what I get (screenshots): this and this.

I’m not the most tech-savvy person in the world so I am really sorry if this is an obvious question. But does anyone have any tips on correcting this?

Same result on multiple browsers, running wordpress2, and using Blix theme.

Alex Günsche am 13. März 2007 um 22:39 #

It might be that the Blix theme has some weird CSS attributes for ul and/or li elements (e.g. fixed width/height or floating), which make the list elements float so strangely. I’m afraid, your only chance is to open the Blix CSS and have a look at the relevant attributes. If they are intended for a specific part of the theme (e.g. the header), then it might help to apply more specific CSS selectors to them.

psycentr am 13. März 2007 um 23:28 #

Hi again…thanks for your quick reply! We fixed it, you were right about looking at the theme. If anyone else has this problem - the changes have to be made in the Forms section of layout.css if you’re using Blix. Then the beautiful advanced search is all better.

Eric am 14. März 2007 um 07:46 #

Hi.

I’ve installed this plugin and it’s perfect for my purposes.

That being said, I can’t get it to work. I am running WP 2.1.2. I’ve dropped the downloaded folder into my plugins directory, activated plugin, etc…

Here’s the advanced search page:
http://www.pqdb.com/demos/ajaz/?page_id=3

But when I search, no results are produced. Can you see what is going wrong?

Thanks!

Eric

Stefan am 16. März 2007 um 12:57 #

Hallo,
das Plugin funktioniert super und ist echt große Spitze.

Jedoch habe ich einen Bug entdeckt, der auch auf der Demo-Resultpage auftritt.

Wenn ich direkt nach der Suche 1x zu den früheren Einträgen blättere und direkt danach wieder zu den späteren blättern will, ist der Suchstring im Eimer.
Das “&” in der url wird durch “#038;” ersetzt.

Blättere ich direkt nach der Suche 2x zu früheren Einträgen ist der Link “Spätere Einträge” dort korrekt.

Gruß, Stefan.

Alex Günsche am 16. März 2007 um 13:15 #

Eric, maybe you’re using the wrong terms? It may be that they are too generic or too short. When I go to your search page and e.g. search for “membres”, I actually do get a result.

Stefan, danke für den Hinweis. Ich kann mir auch schon ungefähr vorstellen, wo es hängt. Ich werde der Sache nachgehen und es für die nächste Version beheben.

tim am 17. März 2007 um 02:20 #

when do you think you will have custom field support?

Aza am 17. März 2007 um 10:32 #

Hi Alex, I’ve just upgraded to version 0.6 (very busy lately…). Everything works good except 2 things:

1. When WP creates the “previous page” link, only from page 2 back to page 1, it converts the ampersand to urlencode and then eats the &, leaving only #038; (as Stefan probably explains in comment 117, sry, don’t speak German :)
That happens only when going from 2 to 1, 3 to 2 is ok, 4 to 3 is ok, etc. Seems like WP bug, probably something to do with get_pagenum_link() in link-template.php but I couldn’t find it. As a temporary workaround I’m using javascript to go back a page. Works ok. Instead of “previous_posts_link()” use
if ( intval($paged) > 1 ) echo '<a href="history.go(-1)" rel="nofollow">« Previous Page</a>';

2. On my site, when search results are displayed, Advanced Search shows the correct number of results per page, as selected - 5, 10, 15, etc. but WP calculates the number of pages according to the “Posts per page” setting in the options. So, if this is 10 (the default) and the results are 32, there will be 4 pages no matter how many results per page are displayed. I was thinking to try to adapt a simple paging function in the search template, so Advanced Search can do the pages independently, but for now an easy workaround is to add
$wp_query->query_vars['posts_per_page'] = $ctas_limit_diff;
around line 474 in advancedsearch.php, just above “For getting paged searches working in WP 2.1″. Hope that helps.

Alex Günsche am 17. März 2007 um 12:31 #

Hi Aza,

wow, you’re amazing. Thanks for your solution (again ;) ). I’ll check it and put it into a new version.

tim: This feature is not on my list right now. See discussions above.

Jürgen am 17. März 2007 um 20:45 #

Very long and complete desciption. Thanks for the time you spend on write it. Jürgen from Germany :-)

Aza am 17. März 2007 um 20:56 #

You’re welcome Alex, I’m glad I could help a bit.

Small correction: in comment 120 when using javascript to go back a page, the link should be “href=”javascript: history.go(-1)”, not just “href=”history.go(-1)”.

Serola am 18. März 2007 um 18:39 #

Nice plugin, and it works unlike other search plugins that I have tested. However, there are a few problems. On some searches I get the following warning:

preg_replace(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 21 in /home/www/wp-content/plugins/advancedsearch/advancedsearch.php on line 560

The second issue is probably caused by unsupported special characters. Scandinavian letters like ä (auml) and ö (ouml) do work but they are not counted in the length of search word. Therefore four letter word like ‘tämä’ is not searched.

I’m using Wordpress 2.0.9 FI and Minima Plus theme.

Serola am 18. März 2007 um 19:02 #

Found some more details on errors occurred on my blog at http://serola.info/ .
Warning “preg_replace(): Compilation failed…” comes if I use asterisk for truncation. I also found that double quote characters for phrase search does not work (nothing found).

I’m using Wordpress 2.0.9 FI and Minima Plus theme.

Serola am 19. März 2007 um 10:14 #

In AdvancedSearch Lite the same problems occurred when using it on WordPress 2.0.9 with Minima Plus theme:

1.High lite feature works but causes ugly warnings if search word is truncated with asterisk. And I found the reason: from high lite array the ‘*’ is missing.
2. Phrase searches using double quote characters does not work.
3. Special characters (like ä ‘auml’) are not counted into word length.

I also found one javascript expression that is needless and not accepted by XHTML-validator. The script that open the small window for search help does not need expression: language=”javascript”.

Nevertheless, this is a wonderful plugin and I am going to use it on my web site. I just love it =)

I also noticed that you have planned to add tag fields into searches. What about the other way around? It would be nice if tags in tag clouds or keywords in category lists could run AdvancedSearch queries. I’m using Jerome’s keyword plugin but I can’t use categories in it since that plugin won’t list search results for pages. For the same reason I can’t define tags for the pages. It is not nice that some keywords or tags that occur only on pages become listed but don’t give any results when selected. So, is there a way to make keywords and tags to use AdvancedSearch queries?

And an other question. Can I use both of the plugins on the same site: AdvancedSearch and AdvancedSearch Lite?

Alex Günsche am 20. März 2007 um 10:13 #

Hello Serola,

thank you very much for your feedback. I’ll check and correct the reported bugs with the next version.

And, yes, you can use AS and AS Lite on the same site. (As you see, I also do.)

edit: By the way, if you find that bug too annoying, you could disable highlighting ($ctas_do_hilite=false in the plugin file).

AA am 21. März 2007 um 23:56 #

download files are corrupt. i would like to try, but even 7-zip does not work

Ryan am 28. März 2007 um 20:21 #

I would love to be able to do a search of custom fields. I would like it to display each of the keys as a dropdown list and a text box of dropdown for the values. The selection of select or textbox should depend on a setting I choose.

I would like this for putting up documents and classifying them.
Thanks, just a vote. Essentially, i would like the same think LK would like.

Ryan

Flash Buddy am 28. März 2007 um 23:00 #

Side Bar Search Possible. While I can copy and paste the code into the sidebar and have a working search it seems when I edit to pare that code down the search breaks.

I’ve been trying to hide the input field (changed text to hidden).

I need some suggestions to get the default search working from the sidebar. Has anybody gotten this concept to work. I’d expect there are many of us with the sidebar search that would like to retain it for aesthetics.

http://impim.com

Aza am 30. März 2007 um 19:51 #

Flash Buddy, I have something similar setup on my site http://www.laptoptips.ca/ , but in the header.
Have a look at the source and copy it if you want, or email me through the form there and I’ll send you the code.

Alex Günsche am 31. März 2007 um 17:35 #

There’s also AdvancedSearch Lite, especially for this purpose. Actually, the sidebar form on my site is AS Lite. AS and AS Lite work fine together.

Subir Ghosh am 1. April 2007 um 11:14 #

I want to use this plugin. But I want to EXCLUDE some categories from the search. I don’t want 3 or 4 categories to show in the list on teh Advanced Search page. Is this possible?

Alex Günsche am 2. April 2007 um 14:07 #

Subir, please have a look at the call to ctas_form_cats(), you can define categories to exclude there.

Subir Ghosh am 2. April 2007 um 17:03 #

Hello Alex:

line 61 ctas_form_cats()

should i make it like

$ctas_form_cats = ctas_form_cats(-3 -4 -5);

Alex Günsche am 2. April 2007 um 19:01 #

No, see below where the function is defined. There is an $exclude parameter which takes comma-separated category ids.

Marco am 7. April 2007 um 15:09 #

Hallo Alex
Dein Plugin ist sensationell!!! Genau das, was ich gesucht habe.

Leider funzt aber etwas nicht unter: “aus diesen Kategorien”
Hier werden nur die zwei Kategorien angezeigt. Alle Anderen fallen weg. Habe die Vermutung, dass es an den Unterkategorien liegen könnte, welche noch nicht alle einen Beitrg besitzen. Hast du mir ne Lösung???

firdaus am 8. April 2007 um 12:49 #

i’ve installed the plug in, working fine, but why when the search does not return anything, the page goes to;

Not Found

Sorry, but you are looking for something that isn’t here.

how to edit this, goes to something like your search is not found

Marco am 12. April 2007 um 15:07 #

Ciao Alex
Mein Problem hat sich erübrigt. Musste einfach die Beiträge in der übergeordneten Kategorie auch anzeigen lassen, dann klappte es.
Merci nochmlas für das super Plugin.

okNYC am 13. April 2007 um 19:57 #

I have the exact same problem as Dennis: old posts are retrieved, new ones aren’t. WHY?
Thank you.

Alex Günsche am 14. April 2007 um 21:39 #

okNYC, I don’t know. Can you point me to an example on your website?

BMW am 16. April 2007 um 17:42 #

cool. Thanks for the plugin.

Matt am 19. April 2007 um 00:49 #

Serola said: “2. Phrase searches using double quote characters does not work.”

I’ve been wrestling with this problem; partly because quoted phrases work ok on my (local) test machine, but not on my live machine… There appears to be a conflict in behaviour between MySql 4.x and 5.x, plus it might be dependent on magic_quotes stuff…

The fix is to go to line 391-ish (Advanced Search v.0.6) and replace the line

$ctas_searchquery = (empty($_GET['ctas_searchquery'])) ? '' : mysql_real_escape_string( $_GET[ctas_searchquery] );

with the line

$ctas_searchquery = (empty($_GET['ctas_searchquery'])) ? '' : mysql_real_escape_string( stripslashes($_GET[ctas_searchquery]) );

(at least it works for me). This is because my search string was going into the MySql server like \\\”string\\\”; on 5.x it doesn’t appear to make a difference…

Cheers! (Great plugin!)

RayzrShrp am 23. April 2007 um 04:52 #

Hmm something with my website is not right I think.

I moved the advancedsearch folder to my plugins directory and I enabled the plugin and created the page called Advanced Search with in the body of the page but when I click the Advanced Search page it just loads a page with on it.

I’ve had this same problem with other plugins where it seems like they just aren’t even running the plugins code. I chowned my entire website directory to my webserver but still no luck. Any ideas?

Lorin Rivers am 23. April 2007 um 21:28 #

I’ve got thousands of authors and I’d like to be able to search on author name and get the author.php for that author. Is that possible?

Gabriele am 24. April 2007 um 18:45 #

Why not all the categories are shown in the search form?

Have a look here http://www.livecity.it/ricerca-avanzata/
It shows just one categorie and its subcategories, where are
the other ones?

Thanks in advance
–Gabriele

m0n am 25. April 2007 um 07:17 #

Thank you for providing this great plugin. However, I need your help. I am trying to create a search page in which the advanced search form remains on the page after the search results have been displayed on the same page — just like the advanced search lite search form remains on the page after a search is executed. Currently, the plugin works great, only the form disappears after every search. Is it possible to keep the form on the page after the search results are displayed next to it (on the same page)? Sorry for the redundancy — just trying to be clear. Thanks!

Lim_Dul am 26. April 2007 um 12:25 #

Ich habe folgendes Problem festgestellt, man kann mit dem Plugin nicht nur nach Kommentaren suchen. Beispielsweise taucht hier im Kommentar 1 oder 2 das Word Pingback auf.

Suche ich nun nach Pingback mit der Erweiterten Suche und haben den Haken nur bei Kommentaren, wird der Beitrag nicht gefunden. Mache ich ihn noch zusätzlich bei den Beiträgen, dann wird der Beitrag gefunden.

Lim_Dul am 26. April 2007 um 12:31 #

Oh, und nochwas, Beiträge die geschrieben und nicht veröffentlich wurde, haben das Datum 0000-00-00 00:00:00, was bei der Berechnung des Startdatums in ctas_form_date dafür sorgt, dass 00 0000 rauskommt.

Simon am 30. April 2007 um 23:29 #

Uh-oh - the search obviously checks the entire html content of a post or page - try searching for ‘href’, for instance. Not that many people will want to search for html code, but if a search term appears in a URL, which it often will if using permalinks, the search results are a mess.

With the highlight search term feature on, such that all found terms get wrapped in a span, I get huge problems if my search term matches any of the post’s html code. If I have a link to, say, /potato/article1.html, then search the site for ‘potato’, the page containing the link appears, but a span is inserted in the middle of the URL code, as in:

<a href="/<span class="highlight">potato</span>/article1.html">Article 1</a>

which renders as a link to a non-existent page called ‘/<span class=’

I could turn the highlighting off (although I’d rather not), but I still don’t want my html to be searched - only the non-html content. I’m not sure what can be done about this, because I have no idea how it would be possible to tell the search not to look inside html tags, but I thought I’d mention it as a problem.

Paul S. am 3. Mai 2007 um 18:31 #

I have installed the plugin. The searches work well, but there is no hilighting. I have checked $ctas_do_hilite and it is set to true. The blog is not public, yet, but if you email me, I’ll send you the link.

Thanks for any help you can offer.

-Paul S.

Martins am 14. Mai 2007 um 13:24 #

Dear Zirona,
thanks for the plugin but there is an error when activating the plugin:
WordPress database error: [The used table type doesn’t support FULLTEXT indexes]
ALTER TABLE wp_posts ADD FULLTEXT ( post_title, post_content )

WordPress database error: [The used table type doesn’t support FULLTEXT indexes]
ALTER TABLE wp_comments ADD FULLTEXT ( comment_content )

I am using advancedsearch 0.6 and WP 2.1.3. And the when trying to search it prints similar error:
WordPress database error: [The used table type doesn’t support FULLTEXT indexes]

btw, looking forward for the search within customfields. For the custom field search try http://guff.szub.net/2006/04/21/search-custom-fields/. Would be nice if this could be merged with Advanced Search.

Martins.

Alex Günsche am 14. Mai 2007