ssborbis / ContextSearch-web-ext

Search engine manager for modern browsers
354 stars 37 forks source link

Search problems with special characters #573

Closed Parvares closed 2 years ago

Parvares commented 2 years ago

Hi, I added this URL to context menu:

https://www.bibliotechediroma.it/opac/query/%s?context=tmatm

I need to enable some special character like:

 ;/’ ()

Here are some examples:

1) Nome della rosa / Umberto Eco The result string is truncated and becomes Nome della rosa (without text after / )

2) Parmenide Platone ; Ferrari  The result string is truncated and becomes Parmenide Platone (without text after ; )

3) Storia dell ' arte veneziana Result: The search parameters are incorrect

I tried in vain setting the encoding for the engine to No Encoding under CS Options -> Search Engines -> [engine] -> Encoding

Thanks very much!

ssborbis commented 2 years ago

There is some filtering / processing happening to search strings when you enter titles into the search bar on that site. You can filter out bad characters using the Modify Terms Regex field like so:

/[';()\/\[\]]//g

Or, you can set it up to search using javascript instead of a GET query.

Parvares commented 2 years ago

Thanky so much, works perfectly with first option (don't know how to manage with second option)! As the search engine above doesn't recognize asterisk * and apostrophe ' would it be possible to replace them with a single blank space?

For example:

L'*acquerello / Marie-Pierre Salé

would be:

L' acquerello / Marie-Pierre Salé

a single blank space replaces *

Also:

Grammatica d'uso della lingua russa

would be:

Grammatica d uso della lingua russa

blank space after d

I treied with this string in Regex field, but doesn't work:

/[*']/""/g Thanks again!

ssborbis commented 2 years ago

I think it would be /[\*']/ /g - note the space between the last two slashes, and the escape character before the asterisk.

FYI, you can chain regex replacements by entering one regex per line in the field. So, if you wanted to combine the 2 examples. it would be

/[;()\/\[\]]//g
/[\*']/ /g
/\s+/ /g

The third line replaces all multiple spaces with a single space.

Parvares commented 2 years ago

Works perfectly now, thanks a lot, ssborbis!! P.S. I changed the addon favicon in the browser toolbar, I'm wondering how I can change the favicon in the context menu, thanks!

change favicon

ssborbis commented 2 years ago

I'm wondering how I can change the favicon in the context menu, thanks!

You can't. The webextensions API doesn't allow it.