Developer forum

Forum » Ecommerce - Standard features » Repository Search

Repository Search

Jason
Reply

I am using repository to create json data. I used one of field to search. This is my query expressions. I used parameter "search".

 

I am trying to search "CASH SALES (SGT) C". And the following is the result.

I am still getting results which are not suppose to be there. Please advise me how to fix it.

 


Replies

 
Nicolai Pedersen
Reply

It is because your field is analyzed. If a field is analyzed it will be divided into terms:

"cash sales (sgt)" will become 3 seperate terms: "cash" "sales" and "sgt" - and if you conduct a search, the string you are looking for will do the same.

So "Sales cash" in the index will be found when searching for "cash sales".

To have exact matches on the entire string, use an unanalyzed field.

Refer to the docs for more information: https://doc.dynamicweb.com/documentation-9/indexing/indexing-search/repositories

 
Jason Htin Lin Aung
Reply

When I change that field back to unanalyzed. Search is not working anymore.

 
Nicolai Pedersen
Reply

Then you have to find the error...

You should probably not use contains, but equals.

It seems like you search for "CASH SALES (SGT) C" but your data shows it is "CASH SALES (SGT) - C"

 
Nicolai Pedersen
Reply

Can I ask if you have read the documentation... Or are you just trying?

 
Jason Htin Lin Aung
Reply

Yes, I am trying to search "CASH SALES (SGT) C" but it is giving me "CASH SALES (SGT) C". I think I am already followed exactly as mentioned on documentation. 

 
Nicolai Pedersen
Reply

Well, you are doing something wrong, so try again!

The field has to by unanalyzed and you need to use an equal operator in the query.

Set it up as simple as possible - remember to build the index after changing analyzed/not analyzed.

 
Jason Htin Lin Aung
Reply

Let's say I am expecting the result "A B , A B C, 1 A B C D" . I will use "A B" as keyword. Do I need to use "equal" with unanalyzed Or "ContainsExtended" with unanalyzed?

Thanks in advance

 
Nicolai Pedersen
Reply
This post has been marked as an answer

You will need containsextended. But it will be slow.

Votes for this answer: 1

 

You must be logged in to post in the forum