Coroico / AdvSearch

Dynamic content search add-on for MODx Revolution that supports results highlighting, faceted search and search in custom packages
21 stars 14 forks source link

minChars and multiple words #59

Closed vierkantemeter closed 10 years ago

vierkantemeter commented 10 years ago

If you search for multiple words (like a sentence) and one of those words is shorter than minChars setting, the minChars error is displayed. For me it would be more logical if this setting calculates the total characters used, not per word.

For example, if I search for:

'a place to stay' I would get the error because 'a' and 'to' are too short.

vierkantemeter commented 10 years ago

besides that, when I add &minChars=1 to the advSearch snippet call, it doesn't seem to work, still defaults to 3.

Edit: I figured the problem with adding minChars=1. The script defaults to '3' if the entered value is lower than 2, so for this to work for 2 characters you have to add minChars=2.

goldsky commented 10 years ago

this is going to be valid for chinese language, but searching 'a' and 'to' seems going to break your server if it returns all of the web's contents, don't you think?

vierkantemeter commented 10 years ago

Yeah, you're right about that, but still some of my clients now complain that some important pages on their site can't be found. They search for a sentence, like 'a place to stay' (but without quotes) and no results are shown, only the error that it's not enough characters. I imagine other site visitors will search the same way.

Maybe it would be better if it worked like this: a) when the search consists of one word with < 3 characters, show the error b) when the search consists of multiple words of which only some are too short, disregard the short words and only search for the longer words. This way, when a user searches for 'a place to stay', the search only uses 'place' and 'stay' and the expected result will probably be found anyway.

To me that would be more intuitive than showing the error even if there are longer words in the search phrase as well. What do you think of this approach?

goldsky commented 10 years ago

Looks like I found where the problem is. This will be improved as well on DB optimization

vierkantemeter commented 10 years ago

Great news, thanks!

goldsky commented 10 years ago

this has been fixed on the upcoming update.