Developer forum

Forum » Swift » Index and query issue in manage accounts search

Index and query issue in manage accounts search

Anna Gaeta Dynamicweb Employee
Anna Gaeta
Reply

Hi,

We've noticed that on 9.15.9, with Swift update v22, there is an inconsistency for searching with special character: '&'

Searching for customer 'A&A' does not return any result as expected - when searching for a customer named A & A Sheet Metal.

My dev team pointed out that it works for some scenarios like Bike & Shop, but not A & A:

https://dev-swiftrizzo.mydwsite1.com/my-account/my-customers?userquery=b+%26+s

https://dev-swiftrizzo.mydwsite1.com/my-account/my-customers?userquery=a+%26+a

 

Thank you,

Anna


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Anna

I do not think that is a change - it has been like that all the time.

The search is based on Lucene - and it contains some built in features. One of them is a list of built in stop words that you would usually not index. "A" is not only a letter, but in english language also a common word like "a search engine" that in a regular search case would be messing up a lot of search results.

Take a look at this section: https://doc.dynamicweb.com/documentation-9/repositories/indexing/custom-fields#4786

You can create your own stopword list by creating a txt file in  /Files/System/Repositories/stopwords.txt based on what is in the default list of stopwords. And then remove the ones you do not want to be used as stopwords - maybe all of them.

BR Nicolai

Votes for this answer: 1
 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Another thing.

The fields containing customer name in the index is probably marked as "Analyzed". This also means that & will not be indexed at all. This will also be the case when using another stopword list. Understanding "Analyzed".

When the name of the customer ("A & A sheet metal products, inc") is indexed, it is broken in to 'terms'. Also when you search, the search input, i.e. "a&a" is also broken into terms.

If the field is analyzed, and you are using the default stopwords list, these terms are going into the index:

  • sheet
  • metal
  • products
  • inc

And when searching for a&a, nothing is left when analyzed because a is a stopword and & is a non-word removed by the analyzer. So nothing is actually searched.

If you index "A & A sheet metal products, inc" without an analyzer, there will be only one term:

  • A & A sheet metal products, inc

And then searching for "a&a" will also yield no results as it is not the same. If you search for "a & a" and you are using a startswith operator, the customer will be found.

Votes for this answer: 1
 
Anna Gaeta Dynamicweb Employee
Anna Gaeta
Reply

Thanks, Nicolai. This makes sense - I will share this with information with my team!

Anna

 

You must be logged in to post in the forum