How to search special character and number with decimal places in .NET

I’m using the trial version of GroupDocs.Search API for .NET framework and I couldn’t get a result of a query of numbers with decimal and special/letter characters. Sample1: 41.9, Sample2: A34.5, Sample3: [A90].
FuzzySearch.Enabled is set to FALSE since I wanted to return the exact match.

1 Like

@jestacs,

Please share following details and we’ll investigate the scenario:

  • API Version that you integrated in the project (e.g. 19.1,19.2)
  • Sample code or project along with source/problematic file(s)

GroupDocs.Search API 19.10.1.
Simple search:
string query = “A41.9”; // also these 41.9, [41]
SearchResult result = index.Search(query);

1 Like

@jestacs,

Thanks for sharing the details.
We are investigating this scenario. Your investigation ticket ID is SEARCHNET-2179. As there is any update, you’ll be notified.

@jestacs,
The given search string contains the separator character (period ‘.’).
The separator characters are not indexed. Index treats them in the same way as the space character.
You can check if the character is a separator with the following code:

string text = "A41.9";
Console.WriteLine(text);
foreach (char c in text)
{
    var type = index.Dictionaries.Alphabet.GetCharacterType(c);
    Console.WriteLine("\t" + c + " - " + type);
}

In the query string, you should replace all separator characters with the space character and perform the phrase search.
A query for the phrase search has the following syntax:

"word1 word2"
"word1 word2 word3"
"word1 word2 word3 word4"

etc.

Examples:

var result1 = index.Search("\"A41.9\""); // This does not work
Console.WriteLine(result1.DocumentCount);

var result2 = index.Search("\"A41 9\""); // This works fine
Console.WriteLine(result2.DocumentCount);

var result3 = index.Search("\"41 9\""); // Not "\"41.9\"" 
Console.WriteLine(result3.DocumentCount);

Thank you very much.

1 Like

@jestacs,

You are welcome.