Keyword

Search Behavior Problem

  • Pierre Balian
  • Pierre Balian's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 3 months ago #67015 by Pierre Balian
Search Behavior Problem was created by Pierre Balian
Is there a way to change the search behavior for k2?

We are using k2mart for a large office supply companies catalog. Their products are all a combination of three letters and three numbers separated by a dash.

For example ABC-123.

When you do a search for ABC-123 you get all product results for any product that is also ABC or 123.

For example
ABC-567
JKH-123
etc. Usually with the exact search you are looking for not the top result on the list. I suspect this is because the dash is ignored during the search?

Is there a way to change(hack if necessary) this behavior?

Thanks.

Please Log in or Create an account to join the conversation.

  • Pierre Balian
  • Pierre Balian's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 3 months ago #67016 by Pierre Balian
Replied by Pierre Balian on topic Re: Search Behavior Problem
Comon, BUMP?

Is there a way to modify the k2 search module so that searches are always "verbatim" aka wrapped in quotes

Transparently of course.

Looking at this string in the search .php of the k2 tools module...
<input type="text" value="<?php echo $text; ?>" name="searchword" maxlength="<?php echo $maxlength; ?>" size="<?php echo $width; ?>" alt="<?php echo $button_text; ?>" class="inputbox" onblur="if(this.value=='') this.value='<?php echo $text; ?>';" onfocus="if(this.value=='<?php echo $text; ?>') this.value='';" />

SO assuming $text is the imput string, how can I enclose it in quotes? I tried doing "$text" at all instances but that seemed to do nothing. Im guessing this is because php interperets the quotes as php syntax? I know next to nothing about php so any help would be appreciated.

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #67017 by Lefteris
Replied by Lefteris on topic Re: Search Behavior Problem
Hi. K2 search operates like Google: if you put your search in double quotes it will search for exact matches.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Pierre Balian
  • Pierre Balian's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 3 months ago #67018 by Pierre Balian
Replied by Pierre Balian on topic Re: Search Behavior Problem
Yes, I am aware of that - what I would like to do is alter the component so that all searches are verbatim, e.g.. in quotes so that the process is transparent for the end user.

If you would read my first post you would know that due to the nature of the k2 item names that search is not functioning ideally for our situation.

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #67019 by Lefteris
Replied by Lefteris on topic Re: Search Behavior Problem
You cannot do this. Maybe you can add quotes with javascrip when user hits the search button. Regarding the results, K2 uses MySQL full text indexing. This by default is indexing words of 4 letters or more. If you need to change this you have to configure MySQL accordingly.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Pierre Balian
  • Pierre Balian's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 months ago #67020 by Pierre Balian
Replied by Pierre Balian on topic Re: Search Behavior Problem
I already set text indexing in mysql to 3 letters and rebuilt the index, however I don't see how that is relative to the issue either, there has to be some way to not ignore the dashes in search!

For instance before we moved to k2mart and were using just virtuemart the default virtuemart search module did NOT ignore the dashes, you could enter an exact product number and the search result would be the exact product you entered.

Please Log in or Create an account to join the conversation.

  • Pierre Balian
  • Pierre Balian's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 months ago #67021 by Pierre Balian
Replied by Pierre Balian on topic Re: Search Behavior Problem
I just want to post again to make this crystal clear. All I want is the ability for search to NOT IGNORE hyphens.

I know that this has to be possible, for example on my site I installed another search component, RSSearch, and it doesnt ignore hyphens - however it doesnt use the k2 generic template for search results and doesnt show the k2 image so it is not ideal for me.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #67022 by Lefteris
Replied by Lefteris on topic Re: Search Behavior Problem
Currently there is no other way than using the quotes. MySQL fulltext search uses the hyphen as a special character. Since you do need this feature modify the K2 code to fit your needs. I assume that we are talking about K2 search. If you can live with Joomla! search you can make a plugin and behave as you want. In that case you can copy the existing K2 search plugin, modify it and disable the original.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #67023 by Odin Mayland
Replied by Odin Mayland on topic Re: Search Behavior Problem
Paul,

What was your solution for exact match searching?

I have extra fields with a dash in the value so I also need all searches to be exact match.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum