From: <udi...@us...> - 2023-05-23 08:40:53
|
Revision: 1476 http://sourceforge.net/p/j-trac/code/1476 Author: udittmer Date: 2023-05-23 08:40:46 +0000 (Tue, 23 May 2023) Log Message: ----------- fix wiki indexing bug, prepare docs for release, HtmlUnit update Modified Paths: -------------- trunk/jtrac/doc/src/index.xml trunk/jtrac/pom.xml trunk/jtrac/src/main/java/info/jtrac/wiki/LucenePageRepository.java Modified: trunk/jtrac/doc/src/index.xml =================================================================== --- trunk/jtrac/doc/src/index.xml 2023-04-19 09:40:29 UTC (rev 1475) +++ trunk/jtrac/doc/src/index.xml 2023-05-23 08:40:46 UTC (rev 1476) @@ -5,7 +5,7 @@ <bookinfo> <title>JTrac</title> <subtitle>User / Developer Guide</subtitle> - <releaseinfo>2.3.0</releaseinfo> + <releaseinfo>2.3.1</releaseinfo> <authorgroup> <author> <firstname>Peter</firstname> @@ -87,8 +87,8 @@ <sect1 id="introduction-releasenotes-2_2"> <title>Release Notes: Version 2.2.0</title> <para> - There is a new table in the database in 2.2.0 to accommodate the new saved link/bookmark feature. Instructions - on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. + A new table in the database accommodates the new saved link/bookmark feature. + Instructions on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. </para> <para> There where a number of new features, changes and bugfixes: @@ -100,7 +100,7 @@ <para>All dates and times can optionally be displayed in a "pretty" format like "10 minutes ago", "2 months ago" etc.</para> </listitem> <listitem> - <para>It's now possible to bookmarks searches, as all relevant parameters are part of the URL.</para> + <para>It's now possible to bookmark searches, as all relevant parameters are part of the URL.</para> </listitem> <listitem> <para>The dashboard can be configured to show a number of links that are relevant to the project, @@ -127,7 +127,7 @@ </itemizedlist> </para> <para> - For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures220">wiki page</ulink> on SourceForge. + For details see <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures220">NewFeatures220</ulink> on SourceForge. </para> </sect1> @@ -134,7 +134,7 @@ <sect1 id="introduction-releasenotes-2_2_1"> <title>Release Notes: Version 2.2.1</title> <para> - There are a couple of new database attributes (in the Space and the StoredSearch tables) in 2.2.1. + A couple of new database attributes have been added (in the Space and the StoredSearch tables). Instructions on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. </para> <para> @@ -164,7 +164,7 @@ </itemizedlist> </para> <para> - For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures221">wiki page</ulink> on SourceForge. + For details see <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures221">NewFeatures221</ulink> on SourceForge. </para> </sect1> @@ -199,9 +199,20 @@ </itemizedlist> </para> <para> - For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures230">wiki page</ulink> on SourceForge. + For details see <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures230">NewFeatures230</ulink> on SourceForge. </para> </sect1> + + <sect1 id="introduction-releasenotes-2_3_1"> + <title>Release Notes: Version 2.3.1</title> + <para> + jTrac 2.3.1 has no new features, but fixes a couple of bugs and updates a few dependencies. + Instructions on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. + </para> + <para> + For details see <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures231">NewFeatures231</ulink> on SourceForge. + </para> + </sect1> </chapter> <chapter id="features"> @@ -1401,12 +1412,6 @@ At this point, we would rather not get into the details of hosting an instance of JTrac on the internet. </para> </sect1> - <sect1 id="faq-references"> - <title>Do you have a list of users or references?</title> - <para> - Plenty. Have a look at this page: <ulink url="https://j-trac.wiki.sourceforge.net/references">https://j-trac.wiki.sourceforge.net/references</ulink> - </para> - </sect1> </chapter> <chapter id="roadmap"> @@ -1423,9 +1428,9 @@ <ulink url="https://lists.sourceforge.net/lists/listinfo/j-trac-users">mailing-list</ulink>. </para> <para> - Note that this roadmap dates all the way back to the 2.1.0 days, and no longer reflects the priorities of the current - development team. Much of this will likely not be implemented, whereas other features not mentioned here will see - the light of the day. If you're missing something in particular (or found a bug), file a ticket in the + <emphasis>Note that this roadmap dates all the way back to the 2.1.0 days, and no longer reflects the priorities of the + current development team. Much of this will likely not be implemented, whereas other features not mentioned here may see + the light of the day.</emphasis> If you're missing something in particular (or found a bug), file a ticket in the <ulink url="https://sourceforge.net/p/j-trac/_list/tickets">appropriate ticket tracker</ulink>, and we'll take it from there. </para> <sect1 id="roadmap-hide"> @@ -1480,6 +1485,7 @@ <title>Wiki Engine</title> <para> There is a plan to embed a wiki-engine into JTrac. This will supplement the requirements management road map. + This has been partially implemented in 2.3.0. </para> </sect1> <sect1 id="roadmap-svn"> @@ -1486,9 +1492,9 @@ <title>Subversion Integration</title> <para> Integration with <ulink url="https://subversion.apache.org/">Subversion</ulink> has already been implemented - using the <ulink url="https://tmate.org/svn/">JavaSVN</ulink> library and this will enable effective - integration of bug reports with commit history in the future. You can try out the existing experimental - support by going to the following url of your JTrac installation: http://[hostname]/jtrac/app/svn + using the <ulink url="https://web.archive.org/web/20061106191343/https://tmate.org/svn/">JavaSVN</ulink> library + and this will enable effective integration of bug reports with commit history in the future. You can try out the + existing experimental support by going to the following url of your JTrac installation: http://[hostname]/jtrac/app/svn </para> <para> <mediaobject> @@ -1912,6 +1918,11 @@ which is also in the "resources" folder. You can easily customize the fonts, colors and icons used across JTrac by just editing a single CSS file. </para> + <para> + Recent versions of jTrac have a number of customization options built in under OPTIONS -> Manage Settings. + There it's possible to change the top-left image, the header text, and the colors used throughout jTrac + without having to jump through the hoops mentioned above, or having to know CSS. + </para> </sect1> <sect1 id="dev-translating"> <title>Adding a language translation for JTrac</title> Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2023-04-19 09:40:29 UTC (rev 1475) +++ trunk/jtrac/pom.xml 2023-05-23 08:40:46 UTC (rev 1476) @@ -67,7 +67,7 @@ <dependency> <groupId>org.htmlunit</groupId> <artifactId>htmlunit</artifactId> - <version>3.1.0</version> + <version>3.2.0</version> <scope>test</scope> </dependency> <dependency> Modified: trunk/jtrac/src/main/java/info/jtrac/wiki/LucenePageRepository.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wiki/LucenePageRepository.java 2023-04-19 09:40:29 UTC (rev 1475) +++ trunk/jtrac/src/main/java/info/jtrac/wiki/LucenePageRepository.java 2023-05-23 08:40:46 UTC (rev 1476) @@ -185,7 +185,7 @@ List<SearchResult> ret = new ArrayList<>(); if (pattern != null && pattern.length() > 0) try { - logger.info("searching for: " + pattern); + logger.debug("searching for: " + pattern); pattern = pattern.replaceAll("\\\"|\\?|\\*|\\(|\\)|\\[|\\]|:|\\+|\\-|\\{|\\}|\\*|~|!|\"|\\\\|\\&", " "); @@ -217,7 +217,7 @@ // also search for the pattern in content directly queryString.append(")"); queryString.append(" OR contents:\"").append(pattern.trim()).append("\""); - logger.info("query:"+queryString.toString()); + logger.debug("query:"+queryString.toString()); IndexSearcher searcher = new IndexSearcher(dir); QueryParser parser = new QueryParser("contents", analyzer); @@ -225,11 +225,11 @@ Hits hits = searcher.search(query); int numDocs = hits.length(); - logger.info(numDocs+" matching documents"); + logger.debug(numDocs+" matching documents"); for (int i = 0; i < numDocs; i++) { Document doc = hits.doc(i); if (doc.get("title") != null) { - //logger.info(doc.get("title")); + //logger.debug(doc.get("title")); Tract tract = get(doc.get("title")); String content = tract.getContent(); String lcContent = content.toLowerCase(); @@ -273,7 +273,6 @@ } } catch (Exception ex) { logger.error("matchingPages: " + ex.getMessage()); - //ex.printStackTrace(); } ret.sort((o1, o2) -> { @@ -286,94 +285,91 @@ } protected void addPageToIndex (String name, Tract page) { + if (page == null) + return; + try { + Term term = new Term("uniqueTitle", ":"+name+":"); + IndexReader reader = IndexReader.open(dir); + int deleted = reader.deleteDocuments(term); + reader.close(); + IndexWriter writer = new IndexWriter(dir, analyzer, false); - if (page != null) { - String content = page.getContent(); - Document doc = new Document(); + String content = page.getContent(); + Document doc = new Document(); - doc.add(new Field("title", name, Field.Store.YES, Field.Index.TOKENIZED)); - if (page.get("seo.name") != null) - doc.add(new Field("altTitle", (String) page.get("seo.name"), Field.Store.YES, Field.Index.TOKENIZED)); - doc.add(new Field("uniqueTitle", ":"+name+":", Field.Store.YES, Field.Index.UN_TOKENIZED)); - doc.add(new Field("contents", content, Field.Store.NO, Field.Index.TOKENIZED)); + doc.add(new Field("title", name, Field.Store.YES, Field.Index.TOKENIZED)); + if (page.get("seo.name") != null) + doc.add(new Field("altTitle", (String) page.get("seo.name"), Field.Store.YES, Field.Index.TOKENIZED)); + doc.add(new Field("uniqueTitle", ":"+name+":", Field.Store.YES, Field.Index.UN_TOKENIZED)); + doc.add(new Field("contents", content, Field.Store.NO, Field.Index.TOKENIZED)); - Term term = new Term("uniqueTitle", ":"+name+":"); - int deleted = IndexReader.open(dir).deleteDocuments(term); - logger.info("indexing "+name+", deleted "+deleted); + logger.info("indexing "+name+", deleted "+deleted); - writer.addDocument(doc); - } - + writer.addDocument(doc); writer.close(); - } catch (Exception e) { - logger.warn("addPageToIndex: " + e.getMessage()); + } catch (Exception ex) { + logger.warn("addPageToIndex: " + ex.getMessage()); } } protected void createIndex() { - (new Thread(() -> { - try { - // set the priority of indexing to minimum, so as not to interrupt other processes - Thread.currentThread().setPriority(Thread.MIN_PRIORITY); - Thread.currentThread().setName("Lucene indexer"); + try { + IndexWriter writer = new IndexWriter(dir, analyzer, true); - IndexWriter writer = new IndexWriter(dir, analyzer, true); + int numPages = 0; - int numPages = 0; + Iterator all = allPageNames(); + while (all.hasNext()) { + String name = (String) all.next(); + // don't index the read and write logs + if (name.equals("RecentChanges")) + continue; - Iterator all = allPageNames(); - while (all.hasNext()) { - String name = (String) all.next(); - // don't index the read and write logs - if (name.equals("RecentChanges")) + Tract tract = get(name); + if (tract != null) { + // there's no point indexing a page that isn't displayed + String redirectTo = tract.getAttribute("redirect.to"); + if (redirectTo != null && redirectTo.length() > 0) continue; - Tract tract = get(name); - if (tract != null) { - // there's no point indexing a page that isn't displayed - String redirectTo = tract.getAttribute("redirect.to"); - if (redirectTo != null && redirectTo.length() > 0) - continue; + //logger.debug("indexing " + name); + String content = tract.getContent(); + if (content != null) { + Document doc = new Document(); - //logger.debug("indexing " + name); - String content = tract.getContent(); - if (content != null) { - Document doc = new Document(); + // Add the title of the page as a field named "title". Use a Text field, + // so that the index stores the title, and it becomes searchable + doc.add(new Field("title", name, Field.Store.YES, Field.Index.TOKENIZED)); + doc.add(new Field("title", new StringBuilder(name).reverse().toString(), Field.Store.YES, Field.Index.TOKENIZED)); - // Add the title of the page as a field named "title". Use a Text field, - // so that the index stores the title, and it becomes searchable - doc.add(new Field("title", name, Field.Store.YES, Field.Index.TOKENIZED)); - doc.add(new Field("title", new StringBuilder(name).reverse().toString(), Field.Store.YES, Field.Index.TOKENIZED)); + // If a better title exists, put it in the index so we can display it instead of the raw page name + if (tract.get("seo.name") != null) + doc.add(new Field("altTitle", (String) tract.get("seo.name"), Field.Store.YES, Field.Index.TOKENIZED)); - // If a better title exists, put it in the index so we can display it instead of the raw page name - if (tract.get("seo.name") != null) - doc.add(new Field("altTitle", (String) tract.get("seo.name"), Field.Store.YES, Field.Index.TOKENIZED)); + // A pseudo-unique ID of the document is stored along with it. + // That way we have a sure way of finding and deleting it from + // the index when the page is updated. + doc.add(new Field("uniqueTitle", ":"+name+":", Field.Store.YES, Field.Index.UN_TOKENIZED)); - // A pseudo-unique ID of the document is stored along with it. - // That way we have a sure way of finding and deleting it from - // the index when the page is updated. - doc.add(new Field("uniqueTitle", ":"+name+":", Field.Store.YES, Field.Index.UN_TOKENIZED)); + // Add the contents of the file a field named "contents". Use an UnStored field, + // so that the contents are indexed, but not actually stored in the index. + doc.add(new Field("contents", content, Field.Store.NO, Field.Index.TOKENIZED)); - // Add the contents of the file a field named "contents". Use an UnStored field, - // so that the contents are indexed, but not actually stored in the index. - doc.add(new Field("contents", content, Field.Store.NO, Field.Index.TOKENIZED)); - - writer.addDocument(doc); - } - numPages++; + writer.addDocument(doc); } + numPages++; } - logger.info("finished indexing " + numPages + " pages"); + } + logger.info("finished indexing " + numPages + " pages"); - writer.optimize(); - writer.close(); - } catch (Exception ex) { - logger.error("createIndex: " + ex.getMessage()); - ex.printStackTrace(); - } - })).start(); + writer.optimize(); + writer.close(); + } catch (Exception ex) { + logger.error("createIndex: " + ex.getMessage()); + ex.printStackTrace(); + } } public class SearchResult { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |