Quantcast
Channel: NBStore Discussions Rss Feed
Viewing all articles
Browse latest Browse all 4081

New Post: Priority order in text search

$
0
0
Hi, following an idea to solve a problem asked for one of my client
The search module call the NEvoweb_NB_Store_Products_GetList store procedure
this procedure search the term in this way, with an OR stripe
PL.ProductName collate Latin1_General_CI_AI like '%6620%' or
 P.ProductRef collate Latin1_General_CI_AI like '%6620%' or
  PL.Summary collate Latin1_General_CI_AI like '%6620%' or
   PL.Manufacturer collate Latin1_General_CI_AI like '%6620%' or
    PL.TagWords collate Latin1_General_CI_AI like '%6620%'  or
     PL.Description collate Latin1_General_CI_AI like '%6620%' )) 
So the problem is that if one product name is 6620 and 6620 is write in other product description the product name 6620 appear after all the other!!!

So for try to obtain a priority I add this
select .....SEOName,TagWords,IsHidden, prio = CASE 
        WHEN ProductName like '%6620%'  THEN 1
        WHEN ProductRef like '%6620%'   THEN 2
      END  

.....
 order by prio desc
Not extremely elegant but it work and now I have a priority made by Product name and Product Ref

Fabio

Viewing all articles
Browse latest Browse all 4081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>