Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with a Uri extraction #84

Closed
HolisticMystic opened this issue Jan 25, 2017 · 4 comments · Fixed by #93
Closed

Problem with a Uri extraction #84

HolisticMystic opened this issue Jan 25, 2017 · 4 comments · Fixed by #93

Comments

@HolisticMystic
Copy link

First, I am very impressed with this project and it appears to be just what I need. That said, I am having very disappointing results retrieving a 'text extract' from a Uri. I was hoping to be able to get a text version of Google results or StackOverflow pages but am getting mostly garbage.
I may have to use a different approach for this requirement.
I was able to extract fairly good text from a very simple webpage with no script and minimal tags, but it still had a few errors.
None the less and in as much ... what a great project. Thanks.

@KevM
Copy link
Owner

KevM commented Jan 25, 2017

Thank you for the nice words. I'm sorry you're having problems can you give us a failing test and we can take a look at helping it get fixed.

@KevM
Copy link
Owner

KevM commented Mar 7, 2017

I happened to use the extract URI overload and am seeing similar junk in the output. It looks like more needs to be done to make this work as expected.

http://www.programcreek.com/java-api-examples/index.php?api=org.apache.tika.io.TikaInputStream

@KevM
Copy link
Owner

KevM commented Mar 31, 2017

I rolledback to a commit pre streaming parsing and URI parsing works correctly. So the problem seems that for web content our ContentHandler is not working as well as the one returned by the ContentHandlerFactory.

        [Test]
        public void should_extract_uri_contents()
        {

            var textExtractionResult = _cut.Extract(metadata =>
            {
                metadata.add("uri", "uri");
                var pageBytes = new WebClient().DownloadData("https://en.wikipedia.org/wiki/Apache_Tika");
                return TikaInputStream.get(pageBytes, metadata);

            });

            textExtractionResult.Text.Should().Contain("Apache Tika is a content detection and analysis framework");
        }

One of the reasons we went to our own content handler was to avoid some weird extra whitespace issues people were running into.

KevM added a commit that referenced this issue Mar 31, 2017
- Restored usage of the Tika Content Handler factory. This may get rid of
  many content issues people have been reporting.
- Using WebClient to download the URI contents as the Tika uri stream
  getter does not do anything.
- Made StreamExtractor obsolete as it is no longer used but is public and
  I didn't want make a breaking change.

Closes #84
@KevM KevM mentioned this issue Mar 31, 2017
@KevM
Copy link
Owner

KevM commented Mar 31, 2017

@HolisticMystic Please take a look at the PR #93 I just posted and let me know if this corrects your problem.

@KevM KevM closed this as completed in #93 Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants