HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Search for items with a hyphen in the name/title

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#111584 (In Topic #22427)
TQ
Avatar

Honoured member

Hi All,

Just about every catalogue entry on my site includes a hyphen in the title eg. KPG-121D (the software part no.) or TK-3301 (the radio the software is for).

Searching for kpg-121d returns 337 results even though there is only 1 item for this title. Searching for just 121d will return the 1 correct result.

My audience almost always searches for either the full software part number or radio which means they seldom find what they are looking for because it's never displayed on the first page or two of the results.

Is there anything I can do about this problem on the site without using the Google add-on?

TQ
Back to the top
 
Posted
Rating:
#111585
Avatar

Does it work if you put quotes around it? What about selecting full-text boolean mode or whatever it is called?


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111586
TQ
Avatar

Honoured member

Hi Chris,

Quotes did nothing and full-text boolean likewise (main_search block).

But, Boolean AND surrounded by quotes DOES work via the advanced search so I've just changed the Main_Search Block to do Boolean searches and, with quotes, that works too.

That's going be OK for savvy users but I'd still like to treat the hyphen as a normal character if that's at all possible.

While I'm on search, the results count is ALWAYS greater than the number of results displayed, sometimes by silly numbers, any idea why?

Thanks as always.

TQ

Back to the top
 
Posted
Rating:
#111587
Avatar

Hi,

Basically it comes down to MySQL limitations.

Full-text breaks down words and happens inside the MySQL engine, we can't really control it. Probably MySQL minimum word length is also a part of it, because 'TK' is too short, so even if quoted to force sequential words, full-text wouldn't even have it in the index.

Boolean is slow because there's no full-text index involved but it's reliable.

Keyword search in v10 probably would work better, because in v10 we pre-break-down keywords (i.e. not comma separated) so we just do an equality search on them rather than full-text or boolean. You'd have to set the product names as keywords.

As for number of results being wrong, yeah that's expected unfortunately. To deduplicate the result count we'd need to load in the full record sets for each query pattern that runs, which can be incredibly slow, especially if searches are broad. So what you see is an approximation.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111588
Avatar

I've added a tracker issue that I think could be useful:
0002835: Automatic quote adding option for search block - Composr CMS feature tracker

Someone could hack something up fairly quickly though in the search block's code.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111589
TQ
Avatar

Honoured member

Thanks for the detailed explanation, now I read your words, I believe we've discussed this before in some context or other.

I have minimum_word_length set to 3 (so that it catches 49D (part of KPG-49D)) but I suspect that setting it to 2 would not be a good idea.

Set to 3, I imagine KPG-121D is treated as KPG AND/OR 121D, hence the 433 results.

I'll see how it goes with Boolean set for main_search block. It IS slow but it may be preferable if I can educate members to use quotes.

Just about the whole site uses both the software title and each of the radios it supports in the keywords (with hyphens) so that bit is at least, V10 ready.

Result approximation, maybe I can change the text by replacing:

Your search for "kpg-121d" gave 433 results:

.. with something more meaningful. Maybe remove the count like:

Your search for "kpg-121d" gave the following results:

They'll get bored long before they reach page 19 (first empty page) of 44.   :lol:

Which prompts another question, how would I change "Your search for “<kbd>{2}</kbd>” gave {1} {1|result|results}:" in Language so that it still correctly stated result or results if I replaced {1} with the word following?

Tnx for the tracker.

TQ
Back to the top
 
Posted
Rating:
#111590
Avatar

{1} {1|result|results}
–>
the following results


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111591
TQ
Avatar

Honoured member

I got that, I was wondering if I could have "result" (for just 1) or "results" (>1) if I removed the {1}

TQ
Back to the top
 
Posted
Rating:
#111592
Avatar

the following {1|result|results}


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: