projectEndings / staticSearch

A codebase to support a pure JSON search engine requiring no backend for any XHTML5 document collection
https://endings.uvic.ca/staticSearch/docs/index.html
Mozilla Public License 2.0
50 stars 22 forks source link

Error on "creating configuration file" on my first attempt to use StaticSearch. #270

Closed peterrobinson closed 1 year ago

peterrobinson commented 1 year ago

I have set up staticSearch and it runs the sample materials just fine: you can read about my experiences getting to this point at https://scholarlydigitaleditions.blogspot.com/2023/07/staticsearch-and-me.html.

(Updated.. different error now

When I run it on my own material, however, at first all seems fine: it finds 11 html files, validates them, and all looks good. But then, I get these errors:

tokenize: [echo] Creating tokenized XHTML files... [xslt] Processing /Applications/staticSearch-1.4.4/mystuff/Teseida/test/html/transcripts/AUT/1r.html to /Applications/staticSearch-1.4.4/mystuff/Teseida/test/staticSearch/ssTemp/html/transcripts/AUT/1r_tokenized.html [xslt] Loading stylesheet /Applications/staticSearch-1.4.4/xsl/tokenize.xsl [xslt] /Applications/staticSearch-1.4.4/xsl/config.xsl:37:0: Fatal Error! The expression is empty [xslt] Failed to process null

BUILD FAILED /Applications/staticSearch-1.4.4/build.xml:239: Java returned: 2

I have no idea why this is not working.

I attach a folder with all my materials and the config file (ssconfig.xml).

test.zip

martindholmes commented 1 year ago

Thanks @peterrobinson , we'll take a look. Are you using Windows, Mac, or Linux?

peterrobinson commented 1 year ago

I am on a MacBook Pro, with Ventura 13.4. The sample files in the 1.4.4 distribution work just fine. See https://scholarlydigitaleditions.blogspot.com/2023/07/staticsearch-and-me.html

peterrobinson commented 1 year ago

Digging a little further: the error points to [xslt] /Applications/staticSearch-1.4.4/xsl/config.xsl:37:0: Fatal Error! The expression is empty Which seems to refer to this line in xsl/config.xsl: <xsl:variable name="kwicLengthHalf" select=""/> xsl/config.xsl is built by /xsl/create_config_xsl.xsl, which refers to "kwicLengthHalf" in this line

 <xso:variable name="kwicLengthHalf"
            select="{xs:integer(round(xs:integer($configDoc//totalKwicLength) div 2))}"/>

I don't see any place where "totalKwicLength" is defined.

totalKwicLength is documented in Appendix A.1.27 <totalKwicLength>, where it says "(If createContexts is set to true, then this parameter controls the length (in words) of the harvested keyword-in-context string.)".

So I added this line to the <params> section of ssconfig.xml file: <totalKwicLength>15</totalKwicLength>

And now I get a different error... [xslt] /Applications/staticSearch-1.4.4/xsl/config.xsl:49:8: Fatal Error! Variable verbose has not been declared (or its declaration is not in scope

So now, I add another line to <params>: <verbose>false</verbose>. And on it goes, and I realize that one indeed needs to include multiple statements in to have SS work. Fiinally, I include the entire <params> section from the configtest.xml file provided in the distribution, and this time:

BUILD SUCCESSFUL
   Total time: 25 seconds

So, we have lift-off!

Suggestions: all this means that the statement in the documentation at 7.5.2 (https://endings.uvic.ca/staticSearch/docs/howDoIUseIt.html#specifyingParameters) that "The <params> element has two required elements for determining the resource collection that you wish to index.." is rather misleading. In fact, you need a whole bunch of things in <params> for static search to work.

joeytakeda commented 1 year ago

Thanks, @peterrobinson — you're right on both counts: basically everything in the exemplar config's params is required for staticSearch to work, but we don't really make that clear in the documentation (nor, in fact, do we even require them within the schema itself). We do have a long-running discussion of this in #195 , so hopefully we'll have some better documentation and validation for the config file in v2.0.

Since it sounds like this is resolved, I'm going to close the issue, but will make a note on #195 about the documentation. Thanks!