It would be great if {vb:raw criteriaDisplay} only returns the raw keywords without the html formatting tags and the prefix "Keyword(s): ". This will greatly help everyone in customizing their forums or in my case, implement Google's Limited Release Adsense for Search feature.

Example: If you search for vBulletin Suite the above variable will return "Keyword(s): <b><u>vBulletin</u></b>, <b><u>Suite</u></b>". It would be better if it simply returned "vBulletin, Suite" as the formatting and the prefix can easily be added through the template.

Any suggestions on how to go around this will be highly appreciated. Thanks!

kh99

25 Jan 2012, 13:37

The prefix is the phrase key_words, so you could possibly edit that (although for some reason it doesn't include the ':' or the parameters). The separating tags are hard-coded in vb/search/criteria.php. You could possibly create a plugin using hook search_complete and make some changes to the criteria string (note that the keywords is only one of the possible criteria displayed in that string).

BeoRski

25 Jan 2012, 15:26

The prefix is the phrase key_words, so you could possibly edit that (although for some reason it doesn't include the ':' or the parameters). The separating tags are hard-coded in vb/search/criteria.php. You could possibly create a plugin using hook search_complete and make some changes to the criteria string (note that the keywords is only one of the possible criteria displayed in that string).
Thank you for your response. If we change it through a plugin, I assume it will also change the overall behavior of the variable. How can we change it so that it is passed on as another variable? I am not a developer but I understand some of the concepts. I would appreciate examples if possible. ^_^

kh99

25 Jan 2012, 15:39

Well, I'm confused about exactly what you want to do. Like I mentioned above, the keywords are only one criteria that can be displayed in the {vb:raw criteriaDisplay} variable, so it seems like you'd want to separate them all, which is a bit more work. Unless you have a separate use for just a list of the keywords? In any case I agree that they have made it very difficult to customize that part of the results display. Most of vb separates the display formatting from the logic, but the search criteria class mostly does it's own formatting for some reason.

BeoRski

25 Jan 2012, 15:43

kh99, you are correct. I am only interested in getting the keyword list.

kh99

25 Jan 2012, 16:10

OK, you could create plugin using hook search_complete and this code:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Then in the template, keywords is an array of arrays, like is described in this comment from the get_words function:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

So for instance I could put this in the template:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Then when I search for test OR moderators (for example), I get this output:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Anyway, I hope that helps.

BeoRski

25 Jan 2012, 16:55

Wow! Thank you very much. I will try it out and post a feedback. ^_^

--------------- Added 1327511155 at 1327511155 ---------------

I have successfully implemented this. Thank you so much for your help kh99!

farru

21 Mar 2013, 05:57

Hey there,

Sorry for bringing this thread back from the dark. I am running 4.2.0 and can't seem to find any reference of 'search_complete' in templates. I assume the template name has been changed? Or, may be i am not looking in the right spot. If anyone can point me in the right direction, i would really appreciate that.

kh99

21 Mar 2013, 11:34

search_complete is a hook location for plugins. If you want to implement the above, you need to go to Plugins & Products > Add New Plugin and select search_complete from the Hook Location dropdown. You also need a title (something so that you'll remember what it's for years from now). Then copy the code into the large box, select the 'Yes" radio button to make it active, and Save.

Then you'd also need to edit the search_resultlist template as is mentioned above.

tbworld

22 Mar 2013, 00:02

KH99 - I am a big fan. Thanks so much for taking the time to help so many people here. I constantly find your replies insightful :).

In my journeys, I noticed that plugin 'search_complete' appears in 'resultsview.php' and 'search.php'. I see why this might be needed, but it also seems as it could cause problems if the user doesn't know. Am I missing something in this assumption?

kh99

22 Mar 2013, 01:04

In my journeys, I noticed that plugin 'search_complete' appears in 'resultsview.php' and 'search.php'. I see why this might be needed, but it also seems as it could cause problems if the user doesn't know. Am I missing something in this assumption?

That was quite a while ago, so I can't remember exactly what I was thinking at the time, but I believe the check for get_class($this) == 'vb_Search_Resultsview' was meant to make sure that the other line is only executed when the resultsview.php hook is called. In fact, looking at it now, I'm not sure why it works because the search.php hook is not in any class, so there would be no $this. Maybe it works because it would just be a null value? Or maybe you're asking because it doesn't work...

tbworld

22 Mar 2013, 02:01

I'm not sure why it works because the search.php hook is not in any class, so there would be no $this. Maybe it works because it would just be a null value? Or maybe you're asking because it doesn't work...

Actually, I never understood it. I just added another hook in the code as to not mess any future execution of code that might call it. I found it interesting that one was part of a class and the other is not. I will have to revisit that code with your thoughts in mind. I guess I figured that it was accidentally given a similar name.

If I do not leave myself some major comments in my code I cannot remember what I did after a week! Thanks so much for your relply :)

kh99

22 Mar 2013, 02:23

Oh, I see, you were asking about the hooks and not this code specifically. I didn't think of that, maybe it is a mistake. I don't have the code in front of me right now so I can't look to see if there's anything in common between the two locations that would make it make sense. I know there are some other hooks that are called in more than one place on purpose, so it's possible that it's not a mistake, but you're right, it could be confusing.

izzet

29 Mar 2013, 04:26

hi http://www.yazsana.net/tag/kabak-tarifleri/ meta desc. or keyword not found :s help me problem pls.