Code Monkey home page Code Monkey logo

Comments (2)

renchap avatar renchap commented on July 18, 2024

Thanks for your report, I have been able to reproduce it. I suspect this comes from the link included in the message, as it contains "activitypub". Maybe our tokeniser when indexing into ES is splitting the URLs into separate tokens?

For example such a link is https://techspot.com/news/102598-avast-free-antivirus-testing-features-learning-about-six.html?utm_source=flipboard&utm_medium=activitypub, and Flipboard adds the UTM parameters to every link.

from mastodon.

jasonculverhouse avatar jasonculverhouse commented on July 18, 2024

I think that you are going to have to strip urls from plain text if you don't want them to be stemmed

Note that this will also happen if you search for amp. You will end up with every result that has more than one query parameter as they are encoded as & in the text. The standard tokenizer is going to index all of these under amp

https://github.com/mastodon/mastodon/blob/3a7aec2807089a004db90851c66db0a007a18a48/app/chewy/statuses_index.rb/#L30-L41

I would think that one could remove the URL's from the searchable_text that is indexed in the :stemmed field.

    field(:text, type: 'text', analyzer: 'verbatim', value: ->(status) { status.searchable_text }) { field(:stemmed, type: 'text', analyzer: 'content') }

There is also a https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-htmlstrip-charfilter.html

Strips HTML elements from a text and replaces HTML entities with their decoded value (e.g, replaces & with &).

Might help?

from mastodon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.