Free Support Forum - groupdocs.com

Search finds the "same" text twice, if used in a hyperlink in .NET

Searching for “text” in the attached document shows 6 hits, although there are supposed to be only 5.
If you search for “highlight” you also get one more result than expected.
It seems to be related to the hyperlink at the bottom of the first page, every word here is found twice.
GroupDocs Parser 20.12 was used in .NET.

Aspose Sample.zip (42.6 KB)

using (Parser parser = new Parser("Aspose Sample.docx"))
{
    // Search a keyword with page numbers
    IEnumerable<SearchResult> sr = parser.Search("text", new SearchOptions(false, false, false, true));

    // Iterate over search results
    foreach (SearchResult s in sr)
    {
        // Print an index, page number and found text:
        Console.WriteLine(string.Format("At {0} (page {1}): {2}", s.Position, s.PageIndex, s.Text));
    }
}

@Clemens_Pestuka

We searched for keyword “highlight” and it showed two results. Although there is only one such word in the source file (Aspose Sample.docx).
And when we searched “text” keyword, it showed 6 results. Contrary, there are 14 results in the Word file.

Could you please confirm?
However, we have logged this behavior at our end. Your investigation ticket ID is PARSERNET-1727.

1 Like

@Atir_Tahir

Yes you’re right, sorry for that. I meant that there are 6 results on the first page, although there should be 5.
Thank you for checking :slight_smile:

@Clemens_Pestuka

You’re welcome. We’ll continue investigation and let you know in case of any update.

1 Like

The issues you have found earlier (filed as PARSERNET-1727) have been fixed in this update. This message was posted using Bugs notification tool by albertakhmetov

@Atir_Tahir

I checked with the new Parser version 21.2, but I still get the described error.
Is there something I have to change in code as well, or should it work out of the box?

@Clemens_Pestuka

We’ll further investigate it and let you know in case of any update.

1 Like