Developer forum

Forum » Ecommerce - Standard features » Index and Search Query

Index and Search Query

Umar Farooq
Reply

Hi,

In Content Indexed I have boosted some fields and used these fileds in FreeText search. on the search page it shows the correct result but seems like the result is not sorted by field boosted e.g if page name contains a string then it should be the first element in search.

In Query publisher I tried to Sort it by Score but no luck and on looking into DW tags "_score" tag value is same on all searched elements.

 

Any suggestions on how to solve this issue?

 

/umar     


Replies

 
Nicolai Pedersen
Reply

Hi Umar

Your free text is probably a summary field where you use "contains" as an operator. Lucene cannot score using contains - you have to use an other operator, see this thread:

https://doc.dynamicweb.com/forum/ecommerce-standard-features/ecommerce-standard-features/control-scoring-of-keywords-in-search-results

So if you have a parameter "q" and your search looks like this:

  • summary <contains> q

No scoring will take place. That is a limitation of Lucene.

You can then do like this:

  • OR group
    • summary <contains> q
    • pagetitle <equals> q

The equals will trigger scoring. The pagetitle field will have to be analyzed so that a pagetitle named "word1 word2" becomes two terms in the index, "word1" and "word2". If you search for pagetitle <equals> 'word1' it will find a result and add scoring. If you search for 'word' instead, the summary <contains> 'word' will ensure the result is returned - but there is no scoring because the pagetitle <equals> 'word' does not trigger a hit.

BR Nicolai

 

You must be logged in to post in the forum