shibukawa / oktavia

Full text search engine for JS environments
MIT License
70 stars 11 forks source link

Uncaught Error: Invalid data file #21

Open tuchida opened 10 years ago

tuchida commented 10 years ago

I made simple html file.

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <div class="body">
      <pre>あいうえお</pre>
      <pre>かきくけこ</pre>
    </div>
  </body>
</html>

And I made index.

$ ./bin/oktavia-mkindex-cli -i ../hoge/ -r ../hoge -m html -u file -f .body -c 5

Result Search Index:

// Oktavia Search Index
var searchIndex = "b3R2YTAUABYABAAPBBYAFgABAAGgPRYAAQABgDIWAAEAAa8OFgABAAE+FQ0ADwALAAcADgAAAAAAAQAHAAMADgAEAAIABQAMAAYABQAHABUACAABAAkACQAKAAQACwAUAAwAAwANAA0ADgAGAAIAFAAMAAEAAAAMIEJERkhKCktNT1FTAAACAAdzY2luFQABAAEAEAEACwF0cy50bAMDdGcPAAEAAUEAAgADcGUDcGU=";

And, I have changed the search.html with reference to the following documents. http://oktavia.info/ja/pages/doc/install_to_sphinx.html

<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="../oktavia/templates/sphinx/_static/oktavia-search.js"></script>
<script type="text/javascript" src="../oktavia/templates/sphinx/_static/oktavia-jquery-ui.js"></script>

<div id="oktavia_search_form" data-index="../hoge/search/searchindex.js"></div>

But I got error on chrome.

Uncaught Error: Invalid data file

I think that document is old. For example, do not find the oktavia/bin/oktavia-mkindex now, found the oktavia/bin/oktavia-mkindex-cli. Are there any plans to update the document?

tuchida commented 10 years ago

Perhaps, the cause is difference of headerSource (oktavia-01 or oktavia-02).

I tried to use oktavia/bin/web/oktavia-jquery-ui.js and oktavia/bin/web/oktavia-web-runtime.js. But I did not understand how to use the Web Worker version.

And does not work non-Web Worker version, because it does not pass a callback function https://github.com/shibukawa/oktavia/blob/c9ce6eff4c702f04f5e6ad9bdb2dca2f8d7f3ebf/bin/web/oktavia-jquery-ui.js#L96 https://github.com/shibukawa/oktavia/blob/c9ce6eff4c702f04f5e6ad9bdb2dca2f8d7f3ebf/bin/web/oktavia-jquery-ui.js#L131

shibukawa commented 10 years ago

Document is written for version 0.5, and now the code is under construction for 1.0. I have no time to maintain now, but in future, I will release 1.0 and the document.

-t cmd should work. HTML integration is completely different now. It needs the following files:

searchindex.js is generated by concatinating dictionary and runtime (bin/web/oktavia-web-runtime.js). Even if non-webworker version, runtime and dictionary are loaded at the same time. Callback strategy was changed from 0.5.

tuchida commented 10 years ago

Thank you! I could be execute.

  1. Make index

    $ ./bin/oktavia-mkindex-cli -i ../hoge/ -r ../hoge/ -m html -u file -f .body -c 5 -t web
  2. Insert html to search.html

    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="../oktavia/bin/web/oktavia-jquery-ui.js"></script>
    <link rel="stylesheet" href="../oktavia/templates/sphinx/_static/searchstyle.css" type="text/css" />
    <div id="oktavia_search_form" data-index="../oktavia/searchindex.js"></div>
  3. View search.html

    If it view the html with file:///, can not execute Web Worker.

Oktavia is very interesting library. We would like to use this for our sphinx document.

Thanks!

shibukawa commented 10 years ago

I keep this issue until document will be updated