Code Monkey home page Code Monkey logo

Comments (5)

fazalmajid avatar fazalmajid commented on July 18, 2024

Temboz should also have a report giving stats on the top filters in the last 2 weeks

from temboz.

fazalmajid avatar fazalmajid commented on July 18, 2024

To identify the rules that are running amok, the following query can help:

select * from (
  select rule_text, sum(case when item_loaded < julianday('2015-06-22') then 1 else 0 end) as before,
  sum(case when item_loaded > julianday('2015-06-22') then 1 else 0 end) as after
  from fm_rules join fm_items on item_rule_uid=rule_uid
  where rule_type like '%_word' group by 1
) order by after/(before + 1) desc limit 20;

where 2015-06-22 should be replaced by whenever you deployed the Porter2 changes.

from temboz.

fazalmajid avatar fazalmajid commented on July 18, 2024

Better yet:

select * from (
  select rule_uid, rule_type, rule_text,
    sum(case when item_loaded < julianday('2015-06-22') then 1 else 0 end)
      as before,
    sum(case when item_loaded > julianday('2015-06-22') then 1 else 0 end)
      as after
  from fm_rules
  join fm_items on item_rule_uid=rule_uid
  where rule_type like '%_word' and rule_type not like '%exactword'
  group by 1,2,3
)
order by after/(before + 1) desc
limit 20;

from temboz.

fazalmajid avatar fazalmajid commented on July 18, 2024

Mitigation involves:

update fm_rules set rule_type=replace(rule_type, '_word', '_exactword')
where rule_uid in (...,...,...);

from temboz.

fazalmajid avatar fazalmajid commented on July 18, 2024

Or:

update fm_rules set rule_type=replace(rule_type, '_word', '_exactword')
where rule_uid in (
  select rule_uid from (
    select rule_uid, rule_type, rule_text,
      sum(case when item_loaded < julianday('2015-06-22') then 1 else 0 end)
        as before,
      sum(case when item_loaded > julianday('2015-06-22') then 1 else 0 end)
        as after
    from fm_rules
    join fm_items on item_rule_uid=rule_uid
    where rule_type like '%_word' and rule_type not like '%exactword'
    group by 1,2,3
  )
  order by after/(before + 1) desc
  limit 20
);

from temboz.

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.