Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-05-31 13:32:07

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,071
Website GitHub Mastodon Twitter

improve search results

One of the problems with the search results is the way it omits spaces.
The name Chang for example v the word change are both returned even if a space is added after the name.
This is something that has already been solved in smd_where_used where Chang only returns the name and Chang returns occurrences of both the name and the word.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2022-05-31 14:45:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,419
Website GitHub

Re: improve search results

Yes but some people might actually want that wildcard search behaviour. My plugin uses binary search if I remember correctly. Having an option in the search tag to switch on binary might be handy if we don’t have that already.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2022-05-31 15:17:42

etc
Developer
Registered: 2010-11-11
Posts: 5,133
Website GitHub

Re: improve search results

You can try m="natural" attribute. Somewhat related?

See the difference between www.neme.org/?m=all&q=peint and www.neme.org/?m=natural&q=peint

Offline

#4 2022-06-01 12:24:50

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: improve search results

etc wrote #333474:

You can try m="natural" attribute. Somewhat related?

I’m so curious (because the results are the kind I’m looking for): where is this m="all" attribute for (in which mysterious tag)? 🤔


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#5 2022-06-01 19:35:14

etc
Developer
Registered: 2010-11-11
Posts: 5,133
Website GitHub

Re: improve search results

It’s actually called match (natural is undocumented though), but all it does is append m=matchtype to the search URL.

Offline

#6 2022-06-02 02:18:45

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: improve search results

I tried to set the match attribute on natural instead of any for the <txp:search_input /> tag.
The request URL didn’t inject any m parameter (Textpattern 4.8.8.)…


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#7 2022-06-02 06:35:11

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: improve search results

How do I add this attribute if I use a form (customised template for the search form)?

Take for example the default templates / theme on the demo site.

the body_header.txp form inserts the <txp:search_input /> tag and it automatically uses the search_input.txp form. However if I add the match attribute – it ignores
that form (and the HTML form construct it contains) for the front-end output and uses a very basic HTML form. But

<txp:search_input match="any" form="search_input" />

ignores the match attribute (that is, the search url is domain.test/?q=crazy+string). ??

The one way I now found is adding this as a hidden input into my form construct – inside search_input.txp form:

<input name="m" type="hidden" value="any">

that does result in the expected domain.test/?m=any&q=crazy+string


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2022-06-02 07:26:05

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,626
GitHub Twitter

Re: improve search results

You’re right, Philippe.
Thank you so much: your solution is perfect and works well. 👌


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#9 2022-06-02 07:46:52

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: improve search results

Pat64 wrote #333505:

You’re right, Philippe.
Thank you so much: your solution is perfect and works well. 👌

Thanks :)

BTW can someone with admin spellchecking powers correct the thread title


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#10 2022-06-02 10:40:01

etc
Developer
Registered: 2010-11-11
Posts: 5,133
Website GitHub

Re: improve search results

phiw13 wrote #333504:

<txp:search_input match="any" form="search_input" />...

ignores the match attribute (that is, the search url is domain.test/?q=crazy+string). ??

Indeed, it only honours match attribute when form="" is set. Otherwise the care of m input inside the form is left with the user, to avoid duplicates. Is it a bug? Dunno..

Offline

#11 2022-06-02 11:27:41

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,138
Website

Re: improve search results

Bug maybe not, but it wasn’t at all clear from the documentation. If my attempt above is the way to go, that is perfectly fine with me. Thanks for the feedback.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#12 2022-06-02 12:11:13

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,220
GitHub

Re: improve search results

phiw13 wrote #333506:

BTW can someone with admin spellchecking powers correct the thread title

Done.

Offline

Board footer

Powered by FluxBB