Developer Forum »
Custom Property Not Indexing Properly
5 posts

Hi,

We have a Content Class that inherits from the native Order class and adds 2 custom properties: OrderType and OrderNumber. The problem is with OrderNumber. OrderNumber has been generated as a GUID so far but stored as a ShortStringPropertyClass. We've been requested to make it searchable in the editor and it's having a couple of issues:

-Dashes are replaced by whitespaces in the index; to find an OrderNumber with content "BC27F589-CF38-490E-B475-54AF3F863840" we have to search "BC27F589 CF38 490E B475 54AF3F863840". This seems consistent with the GUID datatype except when you search for the entire GUID a special search is called for GUID's that OrderNumber is not part of. (An unrelated bug to this is that if you input an entire GUID then replace a hyphen with a whitespace the search throws an exception)

-We're switching away from GUID to a numbered system, but OrderNumber does not appear in the index at all if it's not in GUID format. 

 

Has it been tagged somehow as a GUID even if it is a ShortString? 

181 posts

Hi!

Some questions:

- Is this a .Net 6 site?

- When you say that "OrderNumber does not appear in the index at all if it's not in GUID format". Just to make sure I understand: if OrderNumber is set to "Order245" and you search for "Order245", it doesn't work? Or is it that you don't see the text in text index?

Vidar

5 posts

Hi, sorry for the late reply. I was supposed to get notifications of new posts in this thread but something must have failed there.

- Is is a .Net6 site

- Yes, if OrderNumber is set to "Order245" then searching for "Order245" will not find it. 

5 posts

This is how I add the property to the index. Is this the right approach?

Attachments
181 posts

All properties are automatically added to the general search index. What you are doing adds a separate field to the Lucene search index. You only need to do that if you want to search or filter that field alone. For general searches, you don't need to do that.

After each save, the search index is updated. This can take a few seconds. See the attached video for example on how it takes a few seconds. 

If you try the same on your site, does it work?

Attachments
5 posts

I did some more testing with the information you gave me and the problem seems to be a little different then I originally thought. It's only when OrderNumber is a pure number that it doesn't show up in the search. Here is a list of the OrderNumbers, searchs and results I tested:

 

OrderNumber | Search | Result

1403                | 1403    | Not found

A1403              | A1403  | Found

14A03              | 14A03  | Found

1403A              | 1403A  | Found

14-03               | 14 03   | Found

14-03               | 14-03   | Not Found

14@03             | 14 03    | Found

14@03             | 14@03  | Not Found

 

So the problem we're having right now is that ShortStringPropertyClass with pure numbers are not searchable and special characters and replaced by whitespace.

5 posts

I did some more testing with the information you gave me and the problem seems to be a little different then I originally thought. It's only when OrderNumber is a pure number that it doesn't show up in the search. Here is a list of the OrderNumbers, searchs and results I tested:

 

OrderNumber | Search | Result

1403                | 1403    | Not found

A1403              | A1403  | Found

14A03              | 14A03  | Found

1403A              | 1403A  | Found

14-03               | 14 03   | Found

14-03               | 14-03   | Not Found

14@03             | 14 03    | Found

14@03             | 14@03  | Not Found

 

So the problem we're having right now is that ShortStringPropertyClass with pure numbers are not searchable and special characters are replaced by whitespace.

181 posts

Hi again!

I think the main issue is the special characters. The search engine is Lucene based, and the Standard Analyzer strips special characters and replaces them with space. 

To fix the problem, you can replace the special characters from the search string with space. We're working on a more general fix, but it requires quite a bit of testing.

Regarding the problem with the pure number search, I believe it is actually a problem with the search bar. It works fine in the search module. See the attached pictures. We'll release a fix for the search bar within a day or so. 

Let me know if this fixes

Attachments
1