Jump to content
Latest News: (loading..)
Psytanium

Plural search not working

Recommended Posts

Hello,

if I search for "chairs" the search result is empty, while I have many items with title containing "chair".

Does OSC support plural search by default ? I replaced the files advanced_search and advanced_search_result.php with a fresh copy from osc2.3.4 but still not working.

Thanks :)

Share this post


Link to post
Share on other sites

This is the reason I coded up the Fuzzy Search (which is a commercial module I sell).

It is also the reason I coded into Core (Community Version) the Keywords searching feature.  
If you are using Responsive...you would have chairs as a keyword, and then turn on the search feature.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

I would suggest looking at some of the addons that offer search suggest also.  I use https://apps.oscommerce.com/c1sKS&twitter-typeahead-autocomplete-search

I think it works pretty well and when your customer starts typing characters it starts to display.  All the big online merchants do this and I think it's expected. 

Burt also has a search tag cloud box that I use. 


I'm not really a dog.

Share this post


Link to post
Share on other sites

If you type in chair as a search term, it should be passed to MySQL as something like WHERE text = '%chair%'. That then should match either chair or chairs. Only if the user specifically requests that multiple words be treated as a single term should spaces, etc. count. Otherwise, something like easy chair as a search term should be treated as looking for both %easy% and %chair%. If order is important, or text could be split across hard carriage returns, then more elaborate things would need to be done.

Note that plurals formed by other than simply adding a suffix on to a word are going to be language-dependent, and are probably best left to the user to specify (as plurals). For example, in English, the plural of octopus is either octopodes (the original Greek) or octopuses (the normal English pluralization of a word ending in us). Octopi is for illiterates (it's not a Latin word), although much (?) text is going to use that form, and if the searcher enters only octopus, the (incorrect) plural won't be found. Cow (or steer) and cattle would be another example -- you would just have to enter all forms you're looking for.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites

I already have auto complete addon installed. But I'm discussing the search result after I hit enter.

Now the search result include "chairs" if I search for "chair".
but I need to make the result include "chair" if I search for "chairs"

Probably OSC have this option by default, to strip the S from the last letter of the word, maybe I'm wrong i'm not sure if this feature is already included.

Edited by Psytanium

Share this post


Link to post
Share on other sites

@Psytanium

7 minutes ago, Psytanium said:

I already have auto complete addon installed. But I'm discussing the search result after I hit enter.

Now the search result include "chairs" if I search for "chair".
but I need to make the result include "chair" if I search for "chairs"

Probably OSC have this option by default, to strip the S from the last letter of the word, maybe I'm wrong i'm not sure if this feature is already included.

1) The search result includes "chairs" if you search for "chair". What happens if you search for "chair " (note the space after the word)?

2) I doubt that there is a feature in osC to strip the "S" from the last letter of the word. Besides ...

3) There are a lot of words that end with S that are not plural (lens, bus, cactus, etc), and ...

4) There are lots of other ways that words are made plural, other than adding an S to the end of the word

5) lastly, my experience with the auto complete add-on is ... it will display a list of matching results while you type, and highlight the first one. Once you hit enter, you have selected the highlighted result, and will be taken to that item. How do you want this to be different?

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release here

Share this post


Link to post
Share on other sites

As @ArtcoInc and @MrPhil point out...plural is not easily do-able in the english language;

 

sheep = sheep
shoe = shoes
octopus = octopuses or octopii (maybe not in reality, but that's what I'd have thought it was!) or octopodes
hero = heroes

And so on.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

My point is that with autocomplete, when someone searches "chair" then everything will display that qualifies and they should stop typing.  It's probably never going to be perfect and if you make it idiot proof, then the world will provide better idiots.


I'm not really a dog.

Share this post


Link to post
Share on other sites

Im' not discussing the autocomplete function, I'm talking about the normal search result when you hit enter.

If I search for chairs, the search result should include products with both the words "chair" or "chairs"

so if you search for "cactus" the result is a combination of "cactu" and "cactus"

Share this post


Link to post
Share on other sites
34 minutes ago, burt said:

As @ArtcoInc and @MrPhil point out...plural is not easily do-able in the english language;

 

sheep = sheep
shoe = shoes
octopus = octopuses or octopii (maybe not in reality, but that's what I'd have thought it was!) or octopodes
hero = heroes

And so on.

Im looking to make it :

Shoes = shoe + shoes
Octopus = Octopus + Octopu

Share this post


Link to post
Share on other sites
7 hours ago, Psytanium said:

Im looking to make it :

Shoes = shoe + shoes
Octopus = Octopus + Octopu

I am using below code it helps me remove 's' from the results hence

when I search for results of keyword 'Mukut' on my store:-

Results come as below:-

Search word Mukuts = Results for Mukut

Search word muku= Results for Mukut

Search word muk= Results for Mukut

Search word mukut = Results for Mukut

if (isset($HTTP_GET_VARS['keywords'])) {
      $keywords = tep_db_prepare_input($HTTP_GET_VARS['keywords']);
	  $stringlength = strlen($keywords);
if(substr($keywords, $stringlength-1, $stringlength) == 's') $keywords = substr($keywords, 0, $stringlength-1);
    }

So hence for example even if Jackass is searched and 's' is removed Jackas should return results as Jackass only...

I also use Smart Search addon in addition and selected searched keywords(like Google)- As Suggest result type.

You can also use Extra Product Field addon to add extra search keyword field to products and put in the plural word there. Hence when a customer searches the product it will return in results.

Hope it helps..

Regd./

radhavallabh

Edited by radhavallabh

Share this post


Link to post
Share on other sites

I think the intent of the request was to be able to give plural search terms and have not only plural terms, but also singular terms be found. It's not taking off "s" from results. So long as a customer gives a singular term which is either also the plural (sheep, deer) or is a subset  of the plural (shoe and shoes), they should get a hit in the search, which is the objective. The problem, especially in English, is that there is a wide variety of plural forms for singular nouns, and it's almost impossible (at least at reasonable cost) to go from plural to singular. In many cases, either a customer will simply have to give both singular and plural search terms, or the store owner will have to be careful to include both singular and plural forms in the product description. I think the latter would be a lot easier.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites
On 12/30/2017 at 5:44 AM, radhavallabh said:

I am using below code it helps me remove 's' from the results hence

when I search for results of keyword 'Mukut' on my store:-

Results come as below:-

Search word Mukuts = Results for Mukut

Search word muku= Results for Mukut

Search word muk= Results for Mukut

Search word mukut = Results for Mukut


if (isset($HTTP_GET_VARS['keywords'])) {
      $keywords = tep_db_prepare_input($HTTP_GET_VARS['keywords']);
	  $stringlength = strlen($keywords);
if(substr($keywords, $stringlength-1, $stringlength) == 's') $keywords = substr($keywords, 0, $stringlength-1);
    }

So hence for example even if Jackass is searched and 's' is removed Jackas should return results as Jackass only...

I also use Smart Search addon in addition and selected searched keywords(like Google)- As Suggest result type.

You can also use Extra Product Field addon to add extra search keyword field to products and put in the plural word there. Hence when a customer searches the product it will return in results.

Hope it helps..

Regd./

radhavallabh

Worked as I wanted. thanks :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×