AndrewUlrich
Forum Replies Created
-
Forum: Plugins
In reply to: [Faceted Search] [Plugin: Faceted Search] Ordering of Tags in widgetYou may want to do this on the database side every time you add a new category. Use the following pseudocode to get an idea of what to do:
//get all parent term ids used by facetedsearch terms $query="SELECT DISTINCT tt.parent FROM ".$prefix."_term_taxonomy tt, ".$prefix."_facetedsearch fs WHERE fs.term_id=tt.term_id"; //put all the parent_ids into an array, and loop through each parent id $parent_array = query_to_array($query); foreach($parent_array as $parent_id) { //get all facetedsearch terms with the same parent, ordered alphabetically $query2="SELECT fs.term_id, t.slug FROM ".$prefix."_term_taxonomy tt, ".$prefix."_facetedsearch fs, ".$prefix."_terms t WHERE fs.term_id=tt.term_id AND t.term_id=tt.term_id AND tt.parent_id=".$parent." ORDER BY t.slug"; //put all the terms and slugs into an array $term_array = query_to_array($query); $index = 0; //assign the new order number to each term foreach($term_array as $key->$term) { $term_array[$key]['order'] = $index; $index++; } //do an update query to assign all these new order numbers to their entries in the facetedsearch table $query = "UPDATE ALL THESE THINGS HERE(".$term_array; do_query($query); }
please remember the above is pseudocode and is designed only to get you started. If you figure it out, please consider sharing your code, and maybe I’ll incorporate it into the plugin.
Forum: Plugins
In reply to: [Faceted Search] [Plugin: Faceted Search] Shadowbox Conflict.Sorry, but this is a theme issue. I’m here to work on the Faceted Search plugin itself, not to fix people’s custom themes, even if they are using Faceted Search in that theme. I have to draw the line somewhere, and I hope you understand.
Sorry, but I’m going to have to stop and say that that’s beyond the scope of my maintenance for this plugin. $_REQUEST[‘strm’] is the array that holds all the term ids, which you can count and display however you like, but I can’t write that code for you. You’re going to have to figure out yourself how to proceed further.
you might be able to do it with the tag widget by returning duplicate posts for every match, then count the duplicates, then order the posts by how many duplicates there are. From a quick glance, I don’t see how to do it with categories.
Ok, I’ve just committed a new version of the plugin. It should be easier to put the checkboxes before the labels now.
For the tag widget, search for this:
$returnstring .= '<li '.$selected.'><label for="strm2[]">'.$tag['name'].'</label>'; if(!in_array($tag['name'],$disable_array)) { $returnstring .= '<input type="checkbox" name="strm2[]" value="'.$tag['term_id'].'" />'; }
and replace it with this:
if(!in_array($tag['name'],$disable_array)) { $returnstring .= '<input type="checkbox" name="strm2[]" value="'.$tag['term_id'].'" />'; } $returnstring .= '<li '.$selected.'><label for="strm2[]">'.$tag['name'].'</label>';
For the category widget, search for this:
$returnstring .= $element['name']; $returnstring .= '</label>'; $returnstring .= $checkboxstring; $returnstring .= '</li>';
and replace it with this:
$returnstring .= $checkboxstring; $returnstring .= $element['name']; $returnstring .= '</label>'; $returnstring .= '</li>';
Forum: Fixing WordPress
In reply to: Faceted Search using custom taxonomiesOk, let me see if I can explain it: it sounds like you need to do two things. First, you need to change all references to the term’s taxonomy from ‘category’ to the taxonomy name(s) you need. Second, you need to change the post type from ‘post’ to the post type(s) you need.
From a cursory search, it looks like the term’s taxonomy is referenced in facetedsearch_add_category (in the POST), facetedsearch_delete_category (in the POST), facetedsearch_activate (in the query), and facetedsearch_category_content (in the query).
To find all references to post type, just do a word search for post_type.
Looking this over again, it seems like it should be pretty easy to implement even for multiple categories if you know your post types and taxonomy names. Making it into a configurable option, however, seems like it might be complex.
If anyone wants to help me support this code, please let me know, as my own time is quite limited right now.
Thanks nohler. Right now, one of the search criteria is that the post has ‘published’ status. This means it should not return draft posts. I don’t see draft posts when I test this either…
Basically cut everything within the <input type=”checkbox” …> tag and paste it between the <li class=”facetedsearch”> tag and the <label for=”strm[]” …> tag. This same thing appears on several lines so do it for those several lines.
What theme are you using, btw?
I’m seeing you’re currently using the $_GET method, in which case I think you would see a paging link at the bottom if your theme specifies it, otherwise you’d only get the first 10 results. You say you also get it when you switch to POST though, which shouldn’t happen. In that case, can you switch to post so I can test that too?
Also, can you see if inserting a hidden input with a value=”Search” in lines 550 and 732 make a difference?
If worse comes to worst, you might try replacing all instances of 10 in factedsearch.php with some greater number and see if that makes a difference…
Let me know what you find.
Thanks for the feedback. I’ll try to look into this tomorrow.
To display the selected categories, use $_REQUEST[‘strm’], which is an array of all term ids that have been selected.
You can put a query into your search.php page too look up all the terms by their term id, and display them.
Forum: Plugins
In reply to: [Faceted Search] [Plugin: Faceted Search] Facing Paging problemPlease update to version 3.4 for paged results.
Please update to Version 3.4 to address this issue. You can now set the request method to “Get” in the widget options in order to have the search display in the URL.
In order to retain the ability to include descendants when ancestors are excluded, I’ve decided not to automatically exclude descendants. Since I can’t think of a way to put this into the options and implement it, you’ll just have to exclude descendants manually.
To get around the ‘same name exclusion’ problem, you’ll have to modify the code to use term_id instead of term name for the exclusion list. I think you can just replace “name” with “term_id” in the queries to do this, then put in a comma-separated list of term-id’s instead of term names for your excluded categories list. That’s a start at least.