However, in my defence:
1. It’s such a minor change it doesn’t even deserve to be called a ‘hack’. You don’t need to know Javascript in the slightest. All you need is Notepad. I'd say it's about equivalent to over-riding skin styling with custom CSS.
2. The business case for being able to modify the stop word list is so phenomenally strong that I don’t care that much anyway. Just adding three stop words to the default list stripped a huge number of junk results out of our Knowledge Base search and our users love the new search.
So, here it is. This works for Flare 2019 at least, and I'm pretty sure it would work for Flare 2018 versions too.
1. Generate your HTML5 output as normal.
2. Go to the Scripts folder in your output: Output / <username> / <target> / Resources / Scripts.
3. Copy the file MadCapAll.js.
4. Open this file in a basic text editor.
5. Search for ‘stop’. You’ll be taken to this chunk of code:
Code: Select all
MadCap.Utilities.StopWords=Array("a","an","the","to","of","is","for","and","or","do","be","by","how","he","she","on","in","i","at","it","not","no","are","as","but","her","his","its","non","only","than","that","then","they","this","we","were","which","what","with","you","into","about","after","all","also","been","can","come","from","had","has","have","me","made","many","may","more","most","near","over","some","such","their","there","these","under","use","was","when","where","against","among","became","because","between","during","each","early","found","however","include","late","later","med","other","several","through","until","who","your");
6. Add or delete the stop words you want, within double quotes and separated by commas. Don’t worry about ordering. Don’t edit anything outside the parentheses.
7. Save the file with the same name in a local folder.
8. Add a post-build command in your HTML5 Target > Build Events tab:
Code: Select all
copy /Y "C:\<path>\MadCapAll.js" "$(OutputDirectory)\Resources\Scripts\"
9. Rerun your build and publish and check the difference in search in the output. Your new stop words should produce no results.
10. Distribute the modified file and path to any collaborative authors. If you use source control, each author working on the project will need to put the modified file in the same local path.
11. Each time a new build of Flare is released, repeat the edit of the MadCapAll.js file to capture any new build changes.
That’s it.
Possible Troubleshooting
If nothing has changed, check the timestamp of the MadCapAll.js file in the output > Scripts folder. It should be different to the other files in the folder.
If it’s the same, check your build log to see if your post build command worked or failed.
If it’s different, view the output project in the browser, right-click, and select Inspect. At the bottom of the Inspection window (in Chrome, might be different for other browsers) check the Console tab for error messages. If you see any Javascript errors, you might have accidentally edited outside of the array definition. Start again. It's also possible that you may have saved the file with a different encoding, but this *shouldn't* matter.
I strongly recommend editing MadCapAll.js from the Output folder rather than the original source file that is loaded during build.
Hope this is useful.