Developer forum

Forum » Ecommerce - Standard features » New Index - sort by Name not working

New Index - sort by Name not working

Nuno Aguiar
Reply

Hi,

 

We have the new index engine and manage to set up everything like we wanted, uncluding sorting.

 

The problem is that sorting by Product name does not work. I created the necessary parameter with both Name and ProductName with the same result.

http://rowlf.dw-demo.com/choral/see-all-choral/choral?sortby=ProductName&SortOrder=ASC

 

Can anyone take a look?

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

The index uses "Name" for the product name, so your variable also needs to be called "Name". See dumps below.

Then it works:

http://rowlf.dw-demo.com/choral/see-all-choral/choral?sortby=Name&SortOrder=ASC

Capture.PNG Capture2.PNG
 
Nuno Aguiar
Reply

Hi Nicolai,

 

Ok, but it does not seems to sort accurately. In ascending, the 3rd item is "If" and in desceding you start seeing results with S, E and Z in the first page. Something is wrong.

http://rowlf.dw-demo.com/choral/see-all-choral/choral?sortby=Name&SortOrder=DESC

 

Best Regards,

Nuno Aguiar

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Nuno

That is because the field ProductName from the database is indexed into Name field on the Lucene document using the Schema extender - when it does that, the field i analyzed. When analyzed, the name of the product is split into parts and added to the index - making it impossible to sort by.

So now I've added the ProductName from the database into a Name2 field on the lucene document WITHOUT analyzing it. And then I've added a Name2 parameter. That will give you the desired result - except your product data seems to be requiring a bit of cleaning.

BR Nicolai

Votes for this answer: 1
 
Nuno Aguiar
Reply

Hi Nicolai,

 

Gotcha! Now I understand. BTW: Locing the new index engine. Takes a bit getting used to, but really good.

 

The client does need to clean up the data, but considering it's +35K products, sorting and filtering will definatelly help with that :)

 

Thanks a lot,

Nuno Aguiar

 
Nuno Aguiar
Reply

Hi Nicolai,

 

I was trying to do +/- the same here http://misspiggy.dw-demo.com/services?facilityID=29001

 

I created the new field in the index (check attachment) and set que Query Sorting to be by that field, but makes no difference. What am I doing wrong?

 

Best Regards,

Nuno Aguiar

NameSortable.jpg
 
Adrian Ursu
Reply

Hi guys,

I still have a hard time making it sort.

I believe there si something I have configured wrongly.

From Nicolai's screenshot I see that I have to add a few parameters to the query:

Name, ASC, DESC, Created, Price

What I donlt get is why should I add them as parameters and not SortBy and SortOrder?

Anyway, I have created all as parameters. SOmething changed in the order but it's still not the way it's supposed to.

I have excluded Name from the ProductSchema and added it again without the "Analyze" option.

Same result.

See screenshots with settings.

Thanks,
Adrian

 

Screen_Shot_12-14-15_at_10.46_AM.PNG Screen_Shot_12-14-15_at_10.47_AM.PNG Screen_Shot_12-14-15_at_10.48_AM.PNG Screen_Shot_12-14-15_at_10.49_AM.PNG
 
Nicolai Høeg Pedersen
Reply

You do not have to create SortBy, SortOrder, ASC and DESC as parameters......

If you write &SortBy=ProductName, you need a parameter called ProductName

 
Adrian Ursu
Reply

I made the changes, reindexed and everything is fine now.

Thank you very much for your support and patience.
Adrian

 

You must be logged in to post in the forum