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

Improve search data by refining the article contents metadata #425

Closed
mitchelloharawild opened this issue Nov 23, 2021 · 10 comments · Fixed by #459
Closed

Improve search data by refining the article contents metadata #425

mitchelloharawild opened this issue Nov 23, 2021 · 10 comments · Fixed by #459
Labels
feature request 🗻 a feature request or enhancement next to consider for next release

Comments

@mitchelloharawild
Copy link
Contributor

Would it be possible to modify the xpath expressions to exclude non-text content?
Having a few large interactive outputs results in the search.json and collections to be bloated and slow.
I've made a small change (mitchelloharawild@153f8f9) as a quick fix to only use text within paragraphs for the article contents, but I'm sure this can be improved to only avoid JS within the article's body.

I've attached a minimal example that contains a page with an interactive plot (distill-test.zip).
You can see that the plot data is picked up in the article's search contents.

jsonlite::read_json("_site/search.json")$articles[[2]]$contents
#> [1] "\nMetadata for interactive plots overwhelms site search.\n\n\n{\"x\":{\"visdat\":{\"2a2a1237d6e6\":[\"function () \",\"plotlyVisDat\"]},\"cur_data\":\"2a2a1237d6e6\",\"attrs\":{\"2a2a1237d6e6\":{\"x\":{},\"color\":[\"black\"],\"alpha_stroke\":1,\"sizes\":[10,100],\"spans\":[1,20],\"y\":{},\"type\":\"scatter\",\"mode\":\"lines\",\"inherit\":true},\"2a2a1237d6e6.1\":{\"x\":{},\"color\":[\"red\"],\"alpha_stroke\":1,\"sizes\":[10,100],\"spans\":[1,20],\"y\":{},\"type\":\"scatter\",\"mode\":\"lines\",\"inherit\":true}},\"layout\":{\"margin\":{\"b\":40,\"l\":60,\"t\":25,\"r\":10},\"xaxis\":{\"domain\":[0,1],\"automargin\":true,\"title\":\"date\"},\"yaxis\":{\"domain\":[0,1],\"automargin\":true,\"title\":\"uempmed\"},\"hovermode\":\"closest\",\"showlegend\":true},\"source\":\"A\",\"config\":{\"showSendToCloud\":false},\"data\":[{\"x\":[\"1967-07-01\",\"1967-08-01\",\"1967-09-01\",\"1967-10-01\",\"1967-11-01\",\"1967-12-01\",\"1968-01-01\",\"1968-02-01\",\"1968-03-01\",\"1968-04-01\",\"1968-05-01\",\"1968-06-01\",\"1968-07-01\",\"1968-08-01\",\"1968-09-01\",\"1968-10-01\",\"1968-11-01\",\"1968-12-01\",\"1969-01-01\",\"1969-02-01\",\"1969-03-01\",\"1969-04-01\",\"1969-05-01\",\"1969-06-01\",\"1969-07-01\",\"1969-08-01\",\"1969-09-01\",\"1969-10-01\",\"1969-11-01\",\"1969-12-01\",\"1970-01-01\",\"1970-02-01\",\"1970-03-01\",\"1970-04-01\",\"1970-05-01\",\"1970-06-01\",\"1970-07-01\",\"1970-08-01\",\"1970-09-01\",\"1970-10-01\",\"1970-11-01\",\"1970-12-01\",\"1971-01-01\",\"1971-02-01\",\"1971-03-01\",\"1971-04-01\",\"1971-05-01\",\"1971-06-01\",\"1971-07-01\",\"1971-08-01\",\"1971-09-01\",\"1971-10-01\",\"1971-11-01\",\"1971-12-01\",\"1972-01-01\",\"1972-02-01\",\"1972-03-01\",\"1972-04-01\",\"1972-05-01\",\"1972-06-01\",\"1972-07-01\",\"1972-08-01\",\"1972-09-01\",\"1972-10-01\",\"1972-11-01\",\"1972-12-01\",\"1973-01-01\",\"1973-02-01\",\"1973-03-01\",\"1973-04-01\",\"1973-05-01\",\"1973-06-01\",\"1973-07-01\",\"1973-08-01\",\"1973-09-01\",\"1973-10-01\",\"1973-11-01\",\"1973-12-01\",\"1974-01-01\",\"1974-02-01\",\"1974-03-01\",\"1974-04-01\",\"1974-05-01\",\"1974-06-01\",\"1974-07-01\",\"1974-08-01\",\"1974-09-01\",\"1974-10-01\",\"1974-11-01\",\"1974-12-01\",\"1975-01-01\",\"1975-02-01\",\"1975-03-01\",\"1975-04-01\",\"1975-05-01\",\"1975-06-01\",\"1975-07-01\",\"1975-08-01\",\"1975-09-01\",\"1975-10-01\",\"1975-11-01\",\"1975-12-01\",\"1976-01-01\",\"1976-02-01\",\"1976-03-01\",\"1976-04-01\",\"1976-05-01\",\"1976-06-01\",\"1976-07-01\",\"1976-08-01\",\"1976-09-01\",\"1976-10-01\",\"1976-11-01\",\"1976-12-01\",\"1977-01-01\",\"1977-02-01\",\"1977-03-01\",\"1977-04-01\",\"1977-05-01\",\"1977-06-01\",\"1977-07-01\",\"1977-08-01\",\"1977-09-01\",\"1977-10-01\",\"1977-11-01\",\"1977-12-01\",\"1978-01-01\",\"1978-02-01\",\"1978-03-01\",\"1978-04-01\",\"1978-05-01\",\"1978-06-01\",\"1978-07-01\",\"1978-08-01\",\"1978-09-01\",\"1978-10-01\",\"1978-11-01\",\"1978-12-01\",\"1979-01-01\",\"1979-02-01\",\"1979-03-01\",\"1979-04-01\",\"1979-05-01\",\"1979-06-01\",\"1979-07-01\",\"1979-08-01\",\"1979-09-01\",\"1979-10-01\",\"1979-11-01\",\"1979-12-01\",\"1980-01-01\",\"1980-02-01\",\"1980-03-01\",\"1980-04-01\",\"1980-05-01\",\"1980-06-01\",\"1980-07-01\",\"1980-08-01\",\"1980-09-01\",\"1980-10-01\",\"1980-11-01\",\"1980-12-01\",\"1981-01-01\",\"1981-02-01\",\"1981-03-01\",\"1981-04-01\",\"1981-05-01\",\"1981-06-01\",\"1981-07-01\",\"1981-08-01\",\"1981-09-01\",\"1981-10-01\",\"1981-11-01\",\"1981-12-01\",\"1982-01-01\",\"1982-02-01\",\"1982-03-01\",\"1982-04-01\",\"1982-05-01\",\"1982-06-01\",\"1982-07-01\",\"1982-08-01\",\"1982-09-01\",\"1982-10-01\",\"1982-11-01\",\"1982-12-01\",\"1983-01-01\",\"1983-02-01\",\"1983-03-01\",\"1983-04-01\",\"1983-05-01\",\"1983-06-01\",\"1983-07-01\",\"1983-08-01\",\"1983-09-01\",\"1983-10-01\",\"1983-11-01\",\"1983-12-01\",\"1984-01-01\",\"1984-02-01\",\"1984-03-01\",\"1984-04-01\",\"1984-05-01\",\"1984-06-01\",\"1984-07-01\",\"1984-08-01\",\"1984-09-01\",\"1984-10-01\",\"1984-11-01\",\"1984-12-01\",\"1985-01-01\",\"1985-02-01\",\"1985-03-01\",\"1985-04-01\",\"1985-05-01\",\"1985-06-01\",\"1985-07-01\",\"1985-08-01\",\"1985-09-01\",\"1985-10-01\",\"1985-11-01\",\"1985-12-01\",\"1986-01-01\",\"1986-02-01\",\"1986-03-01\",\"1986-04-01\",\"1986-05-01\",\"1986-06-01\",\"1986-07-01\",\"1986-08-01\",\"1986-09-01\",\"1986-10-01\",\"1986-11-01\",\"1986-12-01\",\"1987-01-01\",\"1987-02-01\",\"1987-03-01\",\"1987-04-01\",\"1987-05-01\",\"1987-06-01\",\"1987-07-01\",\"1987-08-01\",\"1987-09-01\",\"1987-10-01\",\"1987-11-01\",\"1987-12-01\",\"1988-01-01\",\"1988-02-01\",\"1988-03-01\",\"1988-04-01\",\"1988-05-01\",\"1988-06-01\",\"1988-07-01\",\"1988-08-01\",\"1988-09-01\",\"1988-10-01\",\"1988-11-01\",\"1988-12-01\",\"1989-01-01\",\"1989-02-01\",\"1989-03-01\",\"1989-04-01\",\"1989-05-01\",\"1989-06-01\",\"1989-07-01\",\"1989-08-01\",\"1989-09-01\",\"1989-10-01\",\"1989-11-01\",\"1989-12-01\",\"1990-01-01\",\"1990-02-01\",\"1990-03-01\",\"1990-04-01\",\"1990-05-01\",\"1990-06-01\",\"1990-07-01\",\"1990-08-01\",\"1990-09-01\",\"1990-10-01\",\"1990-11-01\",\"1990-12-01\",\"1991-01-01\",\"1991-02-01\",\"1991-03-01\",\"1991-04-01\",\"1991-05-01\",\"1991-06-01\",\"1991-07-01\",\"1991-08-01\",\"1991-09-01\",\"1991-10-01\",\"1991-11-01\",\"1991-12-01\",\"1992-01-01\",\"1992-02-01\",\"1992-03-01\",\"1992-04-01\",\"1992-05-01\",\"1992-06-01\",\"1992-07-01\",\"1992-08-01\",\"1992-09-01\",\"1992-10-01\",\"1992-11-01\",\"1992-12-01\",\"1993-01-01\",\"1993-02-01\",\"1993-03-01\",\"1993-04-01\",\"1993-05-01\",\"1993-06-01\",\"1993-07-01\",\"1993-08-01\",\"1993-09-01\",\"1993-10-01\",\"1993-11-01\",\"1993-12-01\",\"1994-01-01\",\"1994-02-01\",\"1994-03-01\",\"1994-04-01\",\"1994-05-01\",\"1994-06-01\",\"1994-07-01\",\"1994-08-01\",\"1994-09-01\",\"1994-10-01\",\"1994-11-01\",\"1994-12-01\",\"1995-01-01\",\"1995-02-01\",\"1995-03-01\",\"1995-04-01\",\"1995-05-01\",\"1995-06-01\",\"1995-07-01\",\"1995-08-01\",\"1995-09-01\",\"1995-10-01\",\"1995-11-01\",\"1995-12-01\",\"1996-01-01\",\"1996-02-01\",\"1996-03-01\",\"1996-04-01\",\"1996-05-01\",\"1996-06-01\",\"1996-07-01\",\"1996-08-01\",\"1996-09-01\",\"1996-10-01\",\"1996-11-01\",\"1996-12-01\",\"1997-01-01\",\"1997-02-01\",\"1997-03-01\",\"1997-04-01\",\"1997-05-01\",\"1997-06-01\",\"1997-07-01\",\"1997-08-01\",\"1997-09-01\",\"1997-10-01\",\"1997-11-01\",\"1997-12-01\",\"1998-01-01\",\"1998-02-01\",\"1998-03-01\",\"1998-04-01\",\"1998-05-01\",\"1998-06-01\",\"1998-07-01\",\"1998-08-01\",\"1998-09-01\",\"1998-10-01\",\"1998-11-01\",\"1998-12-01\",\"1999-01-01\",\"1999-02-01\",\"1999-03-01\",\"1999-04-01\",\"1999-05-01\",\"1999-06-01\",\"1999-07-01\",\"1999-08-01\",\"1999-09-01\",\"1999-10-01\",\"1999-11-01\",\"1999-12-01\",\"2000-01-01\",\"2000-02-01\",\"2000-03-01\",\"2000-04-01\",\"2000-05-01\",\"2000-06-01\",\"2000-07-01\",\"2000-08-01\",\"2000-09-01\",\"2000-10-01\",\"2000-11-01\",\"2000-12-01\",\"2001-01-01\",\"2001-02-01\",\"2001-03-01\",\"2001-04-01\",\"2001-05-01\",\"2001-06-01\",\"2001-07-01\",\"2001-08-01\",\"2001-09-01\",\"2001-10-01\",\"2001-11-01\",\"2001-12-01\",\"2002-01-01\",\"2002-02-01\",\"2002-03-01\",\"2002-04-01\",\"2002-05-01\",\"2002-06-01\",\"2002-07-01\",\"2002-08-01\",\"2002-09-01\",\"2002-10-01\",\"2002-11-01\",\"2002-12-01\",\"2003-01-01\",\"2003-02-01\",\"2003-03-01\",\"2003-04-01\",\"2003-05-01\",\"2003-06-01\",\"2003-07-01\",\"2003-08-01\",\"2003-09-01\",\"2003-10-01\",\"2003-11-01\",\"2003-12-01\",\"2004-01-01\",\"2004-02-01\",\"2004-03-01\",\"2004-04-01\",\"2004-05-01\",\"2004-06-01\",\"2004-07-01\",\"2004-08-01\",\"2004-09-01\",\"2004-10-01\",\"2004-11-01\",\"2004-12-01\",\"2005-01-01\",\"2005-02-01\",\"2005-03-01\",\"2005-04-01\",\"2005-05-01\",\"2005-06-01\",\"2005-07-01\",\"2005-08-01\",\"2005-09-01\",\"2005-10-01\",\"2005-11-01\",\"2005-12-01\",\"2006-01-01\",\"2006-02-01\",\"2006-03-01\",\"2006-04-01\",\"2006-05-01\",\"2006-06-01\",\"2006-07-01\",\"2006-08-01\",\"2006-09-01\",\"2006-10-01\",\"2006-11-01\",\"2006-12-01\",\"2007-01-01\",\"2007-02-01\",\"2007-03-01\",\"2007-04-01\",\"2007-05-01\",\"2007-06-01\",\"2007-07-01\",\"2007-08-01\",\"2007-09-01\",\"2007-10-01\",\"2007-11-01\",\"2007-12-01\",\"2008-01-01\",\"2008-02-01\",\"2008-03-01\",\"2008-04-01\",\"2008-05-01\",\"2008-06-01\",\"2008-07-01\",\"2008-08-01\",\"2008-09-01\",\"2008-10-01\",\"2008-11-01\",\"2008-12-01\",\"2009-01-01\",\"2009-02-01\",\"2009-03-01\",\"2009-04-01\",\"2009-05-01\",\"2009-06-01\",\"2009-07-01\",\"2009-08-01\",\"2009-09-01\",\"2009-10-01\",\"2009-11-01\",\"2009-12-01\",\"2010-01-01\",\"2010-02-01\",\"2010-03-01\",\"2010-04-01\",\"2010-05-01\",\"2010-06-01\",\"2010-07-01\",\"2010-08-01\",\"2010-09-01\",\"2010-10-01\",\"2010-11-01\",\"2010-12-01\",\"2011-01-01\",\"2011-02-01\",\"2011-03-01\",\"2011-04-01\",\"2011-05-01\",\"2011-06-01\",\"2011-07-01\",\"2011-08-01\",\"2011-09-01\",\"2011-10-01\",\"2011-11-01\",\"2011-12-01\",\"2012-01-01\",\"2012-02-01\",\"2012-03-01\",\"2012-04-01\",\"2012-05-01\",\"2012-06-01\",\"2012-07-01\",\"2012-08-01\",\"2012-09-01\",\"2012-10-01\",\"2012-11-01\",\"2012-12-01\",\"2013-01-01\",\"2013-02-01\",\"2013-03-01\",\"2013-04-01\",\"2013-05-01\",\"2013-06-01\",\"2013-07-01\",\"2013-08-01\",\"2013-09-01\",\"2013-10-01\",\"2013-11-01\",\"2013-12-01\",\"2014-01-01\",\"2014-02-01\",\"2014-03-01\",\"2014-04-01\",\"2014-05-01\",\"2014-06-01\",\"2014-07-01\",\"2014-08-01\",\"2014-09-01\",\"2014-10-01\",\"2014-11-01\",\"2014-12-01\",\"2015-01-01\",\"2015-02-01\",\"2015-03-01\",\"2015-04-01\"],\"y\":[4.5,4.7,4.6,4.9,4.7,4.8,5.1,4.5,4.1,4.6,4.4,4.4,4.5,4.2,4.6,4.8,4.4,4.4,4.4,4.9,4,4,4.2,4.4,4.4,4.4,4.7,4.5,4.8,4.6,4.6,4.5,4.6,4.1,4.7,4.9,5.1,5.4,5.2,5.2,5.6,5.9,6.2,6.3,6.4,6.5,6.7,5.7,6.2,6.4,5.8,6.5,6.4,6.2,6.2,6.6,6.6,6.7,6.6,5.4,6.1,6,5.6,5.7,5.7,6.1,5.7,5.2,5.5,5,4.9,5,5.2,4.9,5.4,5.5,5.1,4.7,5,5.1,4.8,5,4.6,5.3,5.7,5,5.3,5.5,5.2,5.7,6.3,7.1,7.2,8.7,9.4,8.8,8.6,9.2,9.2,8.6,9.5,9,9,8.2,8.7,8.2,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8,6.6,6.8,6.9,6.8,6.8,6.2,6.5,6.3,5.8,6.5,6,6.1,6.2,5.8,5.8,6.1,6,6.1,5.8,5.7,6,6.3,5.2,6.1,6.1,6,5.8,6.1,6.6,5.9,6.3,6,6.8,6.9,7.2,7.3,7.7,8.2,8.4,8.3,8.4,8.9,9.5,11,8.9,9,9.5,9.6,9.3,9.6,9.6,9.5,9.7,10.2,9.9,11.5,10.3,10.1,10.2,10.4,10.3,10.4,10.6,10.2,10.2,9.5,9.9,11,8.9,9.2,9.6,9.5,9.7,9.5,9.4,9.2,9.3,9,9.1,9,8.8,9.2,8.4,8.6,8.5,8.7,8.6,9.1,8.7,8.4,8.5,7.3,8,8.4,8,7.9,8.3,7.5,8.3,8.5,9.1,8.6,8.2,7.7,8.7,8.8,8.7,8.4,8.6,8.4,9,8.7,8.7,9.4,7.9,9,9.7,9.7,10.2,10.4,9.8,10.5,10.7,11.7,12.3,13.1,14.2,17.2,16,16.3,17.8,18.9,19.8,20.1,20,19.9,20.4,22.1,22.3,25.2,22.3,21,20.3,21.2,21,21.9,21.5,21.1,21.5,20.9,21.6,22.4,22,22.4,22,20.6,20.8,20.5,20.8,19.7,19.2,19.1,19.9,20.4,17.5,18.4,18.8,19.9,18.6,17.7,15.8,17.2,17.6,17.1,17.1,17,16.2,16.5,16.5,16.3,17.1,17.3,15.4,15.9,15.8,15.7,14.6,13.8,13.1,12.9,13.4,13.6,13,12.9,13.2,12.9,12,11.5],\"type\":\"scatter\",\"mode\":\"lines\",\"marker\":{\"color\":\"rgba(0,0,0,1)\",\"line\":{\"color\":\"rgba(0,0,0,1)\"}},\"textfont\":{\"color\":\"rgba(0,0,0,1)\"},\"error_y\":{\"color\":\"rgba(0,0,0,1)\"},\"error_x\":{\"color\":\"rgba(0,0,0,1)\"},\"line\":{\"color\":\"rgba(0,0,0,1)\"},\"xaxis\":\"x\",\"yaxis\":\"y\",\"frame\":null},{\"x\":[\"1967-07-01\",\"1967-08-01\",\"1967-09-01\",\"1967-10-01\",\"1967-11-01\",\"1967-12-01\",\"1968-01-01\",\"1968-02-01\",\"1968-03-01\",\"1968-04-01\",\"1968-05-01\",\"1968-06-01\",\"1968-07-01\",\"1968-08-01\",\"1968-09-01\",\"1968-10-01\",\"1968-11-01\",\"1968-12-01\",\"1969-01-01\",\"1969-02-01\",\"1969-03-01\",\"1969-04-01\",\"1969-05-01\",\"1969-06-01\",\"1969-07-01\",\"1969-08-01\",\"1969-09-01\",\"1969-10-01\",\"1969-11-01\",\"1969-12-01\",\"1970-01-01\",\"1970-02-01\",\"1970-03-01\",\"1970-04-01\",\"1970-05-01\",\"1970-06-01\",\"1970-07-01\",\"1970-08-01\",\"1970-09-01\",\"1970-10-01\",\"1970-11-01\",\"1970-12-01\",\"1971-01-01\",\"1971-02-01\",\"1971-03-01\",\"1971-04-01\",\"1971-05-01\",\"1971-06-01\",\"1971-07-01\",\"1971-08-01\",\"1971-09-01\",\"1971-10-01\",\"1971-11-01\",\"1971-12-01\",\"1972-01-01\",\"1972-02-01\",\"1972-03-01\",\"1972-04-01\",\"1972-05-01\",\"1972-06-01\",\"1972-07-01\",\"1972-08-01\",\"1972-09-01\",\"1972-10-01\",\"1972-11-01\",\"1972-12-01\",\"1973-01-01\",\"1973-02-01\",\"1973-03-01\",\"1973-04-01\",\"1973-05-01\",\"1973-06-01\",\"1973-07-01\",\"1973-08-01\",\"1973-09-01\",\"1973-10-01\",\"1973-11-01\",\"1973-12-01\",\"1974-01-01\",\"1974-02-01\",\"1974-03-01\",\"1974-04-01\",\"1974-05-01\",\"1974-06-01\",\"1974-07-01\",\"1974-08-01\",\"1974-09-01\",\"1974-10-01\",\"1974-11-01\",\"1974-12-01\",\"1975-01-01\",\"1975-02-01\",\"1975-03-01\",\"1975-04-01\",\"1975-05-01\",\"1975-06-01\",\"1975-07-01\",\"1975-08-01\",\"1975-09-01\",\"1975-10-01\",\"1975-11-01\",\"1975-12-01\",\"1976-01-01\",\"1976-02-01\",\"1976-03-01\",\"1976-04-01\",\"1976-05-01\",\"1976-06-01\",\"1976-07-01\",\"1976-08-01\",\"1976-09-01\",\"1976-10-01\",\"1976-11-01\",\"1976-12-01\",\"1977-01-01\",\"1977-02-01\",\"1977-03-01\",\"1977-04-01\",\"1977-05-01\",\"1977-06-01\",\"1977-07-01\",\"1977-08-01\",\"1977-09-01\",\"1977-10-01\",\"1977-11-01\",\"1977-12-01\",\"1978-01-01\",\"1978-02-01\",\"1978-03-01\",\"1978-04-01\",\"1978-05-01\",\"1978-06-01\",\"1978-07-01\",\"1978-08-01\",\"1978-09-01\",\"1978-10-01\",\"1978-11-01\",\"1978-12-01\",\"1979-01-01\",\"1979-02-01\",\"1979-03-01\",\"1979-04-01\",\"1979-05-01\",\"1979-06-01\",\"1979-07-01\",\"1979-08-01\",\"1979-09-01\",\"1979-10-01\",\"1979-11-01\",\"1979-12-01\",\"1980-01-01\",\"1980-02-01\",\"1980-03-01\",\"1980-04-01\",\"1980-05-01\",\"1980-06-01\",\"1980-07-01\",\"1980-08-01\",\"1980-09-01\",\"1980-10-01\",\"1980-11-01\",\"1980-12-01\",\"1981-01-01\",\"1981-02-01\",\"1981-03-01\",\"1981-04-01\",\"1981-05-01\",\"1981-06-01\",\"1981-07-01\",\"1981-08-01\",\"1981-09-01\",\"1981-10-01\",\"1981-11-01\",\"1981-12-01\",\"1982-01-01\",\"1982-02-01\",\"1982-03-01\",\"1982-04-01\",\"1982-05-01\",\"1982-06-01\",\"1982-07-01\",\"1982-08-01\",\"1982-09-01\",\"1982-10-01\",\"1982-11-01\",\"1982-12-01\",\"1983-01-01\",\"1983-02-01\",\"1983-03-01\",\"1983-04-01\",\"1983-05-01\",\"1983-06-01\",\"1983-07-01\",\"1983-08-01\",\"1983-09-01\",\"1983-10-01\",\"1983-11-01\",\"1983-12-01\",\"1984-01-01\",\"1984-02-01\",\"1984-03-01\",\"1984-04-01\",\"1984-05-01\",\"1984-06-01\",\"1984-07-01\",\"1984-08-01\",\"1984-09-01\",\"1984-10-01\",\"1984-11-01\",\"1984-12-01\",\"1985-01-01\",\"1985-02-01\",\"1985-03-01\",\"1985-04-01\",\"1985-05-01\",\"1985-06-01\",\"1985-07-01\",\"1985-08-01\",\"1985-09-01\",\"1985-10-01\",\"1985-11-01\",\"1985-12-01\",\"1986-01-01\",\"1986-02-01\",\"1986-03-01\",\"1986-04-01\",\"1986-05-01\",\"1986-06-01\",\"1986-07-01\",\"1986-08-01\",\"1986-09-01\",\"1986-10-01\",\"1986-11-01\",\"1986-12-01\",\"1987-01-01\",\"1987-02-01\",\"1987-03-01\",\"1987-04-01\",\"1987-05-01\",\"1987-06-01\",\"1987-07-01\",\"1987-08-01\",\"1987-09-01\",\"1987-10-01\",\"1987-11-01\",\"1987-12-01\",\"1988-01-01\",\"1988-02-01\",\"1988-03-01\",\"1988-04-01\",\"1988-05-01\",\"1988-06-01\",\"1988-07-01\",\"1988-08-01\",\"1988-09-01\",\"1988-10-01\",\"1988-11-01\",\"1988-12-01\",\"1989-01-01\",\"1989-02-01\",\"1989-03-01\",\"1989-04-01\",\"1989-05-01\",\"1989-06-01\",\"1989-07-01\",\"1989-08-01\",\"1989-09-01\",\"1989-10-01\",\"1989-11-01\",\"1989-12-01\",\"1990-01-01\",\"1990-02-01\",\"1990-03-01\",\"1990-04-01\",\"1990-05-01\",\"1990-06-01\",\"1990-07-01\",\"1990-08-01\",\"1990-09-01\",\"1990-10-01\",\"1990-11-01\",\"1990-12-01\",\"1991-01-01\",\"1991-02-01\",\"1991-03-01\",\"1991-04-01\",\"1991-05-01\",\"1991-06-01\",\"1991-07-01\",\"1991-08-01\",\"1991-09-01\",\"1991-10-01\",\"1991-11-01\",\"1991-12-01\",\"1992-01-01\",\"1992-02-01\",\"1992-03-01\",\"1992-04-01\",\"1992-05-01\",\"1992-06-01\",\"1992-07-01\",\"1992-08-01\",\"1992-09-01\",\"1992-10-01\",\"1992-11-01\",\"1992-12-01\",\"1993-01-01\",\"1993-02-01\",\"1993-03-01\",\"1993-04-01\",\"1993-05-01\",\"1993-06-01\",\"1993-07-01\",\"1993-08-01\",\"1993-09-01\",\"1993-10-01\",\"1993-11-01\",\"1993-12-01\",\"1994-01-01\",\"1994-02-01\",\"1994-03-01\",\"1994-04-01\",\"1994-05-01\",\"1994-06-01\",\"1994-07-01\",\"1994-08-01\",\"1994-09-01\",\"1994-10-01\",\"1994-11-01\",\"1994-12-01\",\"1995-01-01\",\"1995-02-01\",\"1995-03-01\",\"1995-04-01\",\"1995-05-01\",\"1995-06-01\",\"1995-07-01\",\"1995-08-01\",\"1995-09-01\",\"1995-10-01\",\"1995-11-01\",\"1995-12-01\",\"1996-01-01\",\"1996-02-01\",\"1996-03-01\",\"1996-04-01\",\"1996-05-01\",\"1996-06-01\",\"1996-07-01\",\"1996-08-01\",\"1996-09-01\",\"1996-10-01\",\"1996-11-01\",\"1996-12-01\",\"1997-01-01\",\"1997-02-01\",\"1997-03-01\",\"1997-04-01\",\"1997-05-01\",\"1997-06-01\",\"1997-07-01\",\"1997-08-01\",\"1997-09-01\",\"1997-10-01\",\"1997-11-01\",\"1997-12-01\",\"1998-01-01\",\"1998-02-01\",\"1998-03-01\",\"1998-04-01\",\"1998-05-01\",\"1998-06-01\",\"1998-07-01\",\"1998-08-01\",\"1998-09-01\",\"1998-10-01\",\"1998-11-01\",\"1998-12-01\",\"1999-01-01\",\"1999-02-01\",\"1999-03-01\",\"1999-04-01\",\"1999-05-01\",\"1999-06-01\",\"1999-07-01\",\"1999-08-01\",\"1999-09-01\",\"1999-10-01\",\"1999-11-01\",\"1999-12-01\",\"2000-01-01\",\"2000-02-01\",\"2000-03-01\",\"2000-04-01\",\"2000-05-01\",\"2000-06-01\",\"2000-07-01\",\"2000-08-01\",\"2000-09-01\",\"2000-10-01\",\"2000-11-01\",\"2000-12-01\",\"2001-01-01\",\"2001-02-01\",\"2001-03-01\",\"2001-04-01\",\"2001-05-01\",\"2001-06-01\",\"2001-07-01\",\"2001-08-01\",\"2001-09-01\",\"2001-10-01\",\"2001-11-01\",\"2001-12-01\",\"2002-01-01\",\"2002-02-01\",\"2002-03-01\",\"2002-04-01\",\"2002-05-01\",\"2002-06-01\",\"2002-07-01\",\"2002-08-01\",\"2002-09-01\",\"2002-10-01\",\"2002-11-01\",\"2002-12-01\",\"2003-01-01\",\"2003-02-01\",\"2003-03-01\",\"2003-04-01\",\"2003-05-01\",\"2003-06-01\",\"2003-07-01\",\"2003-08-01\",\"2003-09-01\",\"2003-10-01\",\"2003-11-01\",\"2003-12-01\",\"2004-01-01\",\"2004-02-01\",\"2004-03-01\",\"2004-04-01\",\"2004-05-01\",\"2004-06-01\",\"2004-07-01\",\"2004-08-01\",\"2004-09-01\",\"2004-10-01\",\"2004-11-01\",\"2004-12-01\",\"2005-01-01\",\"2005-02-01\",\"2005-03-01\",\"2005-04-01\",\"2005-05-01\",\"2005-06-01\",\"2005-07-01\",\"2005-08-01\",\"2005-09-01\",\"2005-10-01\",\"2005-11-01\",\"2005-12-01\",\"2006-01-01\",\"2006-02-01\",\"2006-03-01\",\"2006-04-01\",\"2006-05-01\",\"2006-06-01\",\"2006-07-01\",\"2006-08-01\",\"2006-09-01\",\"2006-10-01\",\"2006-11-01\",\"2006-12-01\",\"2007-01-01\",\"2007-02-01\",\"2007-03-01\",\"2007-04-01\",\"2007-05-01\",\"2007-06-01\",\"2007-07-01\",\"2007-08-01\",\"2007-09-01\",\"2007-10-01\",\"2007-11-01\",\"2007-12-01\",\"2008-01-01\",\"2008-02-01\",\"2008-03-01\",\"2008-04-01\",\"2008-05-01\",\"2008-06-01\",\"2008-07-01\",\"2008-08-01\",\"2008-09-01\",\"2008-10-01\",\"2008-11-01\",\"2008-12-01\",\"2009-01-01\",\"2009-02-01\",\"2009-03-01\",\"2009-04-01\",\"2009-05-01\",\"2009-06-01\",\"2009-07-01\",\"2009-08-01\",\"2009-09-01\",\"2009-10-01\",\"2009-11-01\",\"2009-12-01\",\"2010-01-01\",\"2010-02-01\",\"2010-03-01\",\"2010-04-01\",\"2010-05-01\",\"2010-06-01\",\"2010-07-01\",\"2010-08-01\",\"2010-09-01\",\"2010-10-01\",\"2010-11-01\",\"2010-12-01\",\"2011-01-01\",\"2011-02-01\",\"2011-03-01\",\"2011-04-01\",\"2011-05-01\",\"2011-06-01\",\"2011-07-01\",\"2011-08-01\",\"2011-09-01\",\"2011-10-01\",\"2011-11-01\",\"2011-12-01\",\"2012-01-01\",\"2012-02-01\",\"2012-03-01\",\"2012-04-01\",\"2012-05-01\",\"2012-06-01\",\"2012-07-01\",\"2012-08-01\",\"2012-09-01\",\"2012-10-01\",\"2012-11-01\",\"2012-12-01\",\"2013-01-01\",\"2013-02-01\",\"2013-03-01\",\"2013-04-01\",\"2013-05-01\",\"2013-06-01\",\"2013-07-01\",\"2013-08-01\",\"2013-09-01\",\"2013-10-01\",\"2013-11-01\",\"2013-12-01\",\"2014-01-01\",\"2014-02-01\",\"2014-03-01\",\"2014-04-01\",\"2014-05-01\",\"2014-06-01\",\"2014-07-01\",\"2014-08-01\",\"2014-09-01\",\"2014-10-01\",\"2014-11-01\",\"2014-12-01\",\"2015-01-01\",\"2015-02-01\",\"2015-03-01\",\"2015-04-01\"],\"y\":[12.6,12.6,11.9,12.9,12.8,11.8,11.7,12.3,11.7,12.3,12,11.7,10.7,10.5,10.6,10.8,10.6,11.1,10.3,9.7,10.2,9.7,10.1,11.1,11.8,11.5,11.6,11.4,11.6,11.8,11.8,11.7,12.4,13.3,12.4,12.3,13.5,13.4,12.9,13.1,13.6,13.2,13.3,13.3,13.5,13.2,13.6,14.7,13.8,13.6,13.3,13.3,13.1,13,12.5,12.8,11.8,11.5,11.7,11.7,11.7,12,12.2,13,13.6,13.7,12.4,12.5,12.7,13.2,13.2,13.6,13.2,13.9,13.1,14.4,14.4,14.8,14.3,14.2,13.4,13.1,12.8,12.8,12.8,12.1,12.9,13.4,13.8,14,13.2,12.5,12.7,14.2,17.3,14.3,12.6,13,13,13.4,12.7,12,11.7,12.3,12.2,11.7,12.3,11.4,11.7,11.7,11.4,11.1,11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.4,6.2,5.9,5.2,4.9,4.8,4.8,4.7,4.2,4.6,4.8,4.4,5.4,4.8,4.5,5,4.9,4.9,5.2,5.2,4.5,4.6,4.5,4.2,4.8,4.9,5.3,5,4.5,4.5,5.6,6.8,7,3.4,4.1,4.5,6.1,5.8,5.9,5.8,6.5,6.4,5.5,5.4,5.7,5.7,5.7,5.5,5.5,5.6,5.3,5.3,5.8,5.6,6.3,6,5.2,5.3,5.4,5.4,5,5,4.9,5.3,5.3,5.8,5.3,5.2,4.6,4.5,4.1,6.9,3.7,3.4,3.6,3.1,3.5,2.9,2.2,2.7,2.7,3.1,3.5,3.7,4.2,4.2,4.2,4,3.8,4,3.4,3.6,3.6,3.6,3.9,3.7,3.7,4.1,4.4,4.2,4,3.8,3.7,3.4,3.5,3.4,3.1,3.6,3.7,4.1,4,3.4,7.8,5.5,4.4,3.8,4.7,5.5,6.4,6.4,6.2,5.5,5.9,6.8,8.2,6.7,6,4.9,5.9,5.4,5.9,5.9,6.1,5.8,5.7,6.4,7,6.9,6.8,6.9,6.7,6.6,6.6,7.1,7.4,7.6,7,6.9,6.9,7.2,7.3,7.2,6.8,6.8,7,7.8,8,8,8.5,8.7,8.8,9.1,8.2,8,8.2,8.8,9.7,12,6.3,5.8,5.9,6.4,6.7,6.8,6.6,6.7,6.8,6.3,6.2,6.4,7.1,7.3,7.4,7.4,7.4,7.4,7.5,7.2,7.4,7.2,7.3,7.6,7.7,7.9,7.4,7.6],\"type\":\"scatter\",\"mode\":\"lines\",\"marker\":{\"color\":\"rgba(255,0,0,1)\",\"line\":{\"color\":\"rgba(255,0,0,1)\"}},\"textfont\":{\"color\":\"rgba(255,0,0,1)\"},\"error_y\":{\"color\":\"rgba(255,0,0,1)\"},\"error_x\":{\"color\":\"rgba(255,0,0,1)\"},\"line\":{\"color\":\"rgba(255,0,0,1)\"},\"xaxis\":\"x\",\"yaxis\":\"y\",\"frame\":null}],\"highlight\":{\"on\":\"plotly_click\",\"persistent\":false,\"dynamic\":false,\"selectize\":false,\"opacityDim\":0.2,\"selected\":{\"opacity\":1},\"debounce\":0},\"shinyEvents\":[\"plotly_hover\",\"plotly_click\",\"plotly_selected\",\"plotly_relayout\",\"plotly_brushed\",\"plotly_brushing\",\"plotly_clickannotation\",\"plotly_doubleclick\",\"plotly_deselect\",\"plotly_afterplot\",\"plotly_sunburstclick\"],\"base_url\":\"https://plot.ly\"},\"evals\":[],\"jsHooks\":[]}\n\n\n\n"

Created on 2021-11-24 by the reprex package (v2.0.0)

@mitchelloharawild
Copy link
Contributor Author

@cderv Could you offer your opinion on this? For building the rjournal distill website with >1000 article this file gets very large, causing substantial slowdown. My fork helps with this, but I expect to need to reduce the scope of the search.json file further (perhaps only titles, names, and maybe abstracts/descriptions).

Alternatively, is there some way of suppressing the generation of search.json to replace it with our own more narrow version? I couldn't find a way of preventing write_search_json() from running with the rjdistill_website site generator.

@cderv
Copy link
Collaborator

cderv commented Mar 23, 2022

Hi,

thanks for pinging ! With such a large website, I can see how this can problematic. We can definitely refine the search.json file. We already do that in bookdown. Stripping <script> element is the lease that we could do. But we need a bit more than <p> tags I think. Unless you need something very specific, I think we could make the improvement in distill directly.

I'll have a closer look at what is done in bookdown::gitbook(), bookdown::bs4_book() and also Quarto probably.

Alternatively, is there some way of suppressing the generation of search.json to replace it with our own more narrow version? I couldn't find a way of preventing write_search_json() from running with the rjdistill_website site generator.

You can deactivate search feature from distill using search YAML key: https://rstudio.github.io/distill/website.html#site-search

Then you would need to come up with your own processing to create the search - this is also feasible if you want something quite specific.

@cderv cderv added the feature request 🗻 a feature request or enhancement label Mar 23, 2022
@cderv cderv moved this to Backlog in R Markdown Team Projects Mar 23, 2022
@cderv cderv moved this from Backlog to Todo in R Markdown Team Projects Mar 23, 2022
@cderv cderv added the next to consider for next release label Mar 23, 2022
@cderv cderv changed the title Interactive outputs bloat article contents metadata Improve search data by refining the article contents metadata Mar 23, 2022
@mitchelloharawild
Copy link
Contributor Author

Thanks! I did start by trying to strip out <script>, but it was beyond my xpath skills.
From what I can tell from the distill package code, setting search to FALSE in the yaml removes the search feature from the navbar but the large search.json file is still produced.

Would it be possible to add a condition on site_search_enabled(site_config) for writing the search.json file here?

# write top level article search index
write_search_json(input, config)

@cderv
Copy link
Collaborator

cderv commented Mar 23, 2022

From what I can tell from the distill package code, setting search to FALSE in the yaml removes the search feature from the navbar but the large search.json file is still produced.

Oh indeed, it would make sense to not write the json in that case. We should probably check using

distill/R/navigation.R

Lines 370 to 381 in d5545b7

site_search_enabled <- function(site_config, default = TRUE) {
navbar <- site_config[["navbar"]]
if (is.list(navbar)) {
search <- site_config[["navbar"]][["search"]]
if (is.logical(search))
search
else
default
} else {
FALSE
}
}

and only write the file when activated.

Do you want to make a PR and test it your website ?

@cderv
Copy link
Collaborator

cderv commented Mar 30, 2022

@mitchelloharawild #449 should solve part of the issue by allowing you to not write the search.json.

I'll look also on how to correctly remove some content from the document in the search file.

@cderv cderv moved this from Todo to In Progress in R Markdown Team Projects Mar 30, 2022
@mitchelloharawild
Copy link
Contributor Author

Great, thanks!

@werkstattcodes
Copy link

@mitchelloharawild #449 should solve part of the issue by allowing you to not write the search.json.

I'll look also on how to correctly remove some content from the document in the search file.

Very nice to see this being implemented many thank.
Do you think there is an overlap when it comes to resolving this issue..
My e.g. reactable table bloated the json file to an extent that the search became effectively unusable.

@cderv
Copy link
Collaborator

cderv commented Mar 31, 2022

Oh yes, this seems definitely related. I'll take that into account. thanks a lot !

cderv added a commit that referenced this issue May 11, 2022
* Do not write search file if search is deactivated in config

Related to #425
Repository owner moved this from In Progress to Done in R Markdown Team Projects May 11, 2022
@cderv
Copy link
Collaborator

cderv commented May 11, 2022

I have made the change in dev version so that content in <script> and <style> tag inside the document body are ignored from search content.

This should make your website with htmlwidgets like plotly a lot quicker to load.

@mitchelloharawild
Copy link
Contributor Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request 🗻 a feature request or enhancement next to consider for next release
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants