1
0
mirror of https://github.com/c9fe/22120.git synced 2024-11-09 20:42:37 +01:00
This commit is contained in:
Cris Stringfellow 2021-12-27 20:28:59 +08:00
parent b672e3cca7
commit 0ffdb5094e
6 changed files with 27 additions and 9 deletions

View File

@ -1,10 +1,11 @@
- trigram segmenter not working as expected. (e.g downey JR not getting correct on avenger endgame search page). fix
- complete snippet generation
- improve title boosting of ranks
- improve trigram segmenter: lower max segment length, increase fore and aft context
- sometimes snippets do not appear (e.g. avenger endgame google search result for hemsworth query)
- save trigram index to disk
- let's not reindex unless we have changed contentSignature
- result paging
- publish button
- added placeholder on dashboard page
- We need to not open other localhosts if we already have one open
- We need to reload on localhost 22120 if we open with that
- ensure we are getting the page text to index once it is actually loaded (we should call again later, or add mutation observer and update on mutate)

View File

@ -32,6 +32,10 @@
<input type=radio name=mode value=serve id=serve>
Serve
</label>
<label disabled>
<input disabled type=radio name=mode value=select id=select>
Select (<em>Bookmark mode</em>)
</label>
<output name=notification>
<p>
<button>Change mode</button>
@ -80,6 +84,17 @@
</script>
</fieldset>
</form>
<form disabled method=POST action=/publish>
<fieldset>
<legend>Publish your archive</legend>
<p>
Publish a search engine from your archive
<br>
<small>This will generate a server.zip file that you can unzip and run</small>
<p>
<button disabled>Publish</button>
</fieldset>
</form>
<footer>
<cite>
<a rel=author href=https://github.com/i5ik/22120>22120 GitHub</a>

View File

@ -23,6 +23,9 @@
cursor: default;
font-style: italic;
}
:is(form, label)[disabled] {
color: grey;
}
em.caps {
font-style: normal;
font-variant: small-caps;

View File

@ -963,7 +963,7 @@ export default Archivist;
flex.forEach(countRank(score));
ndx.forEach(countRank(score));
fuzz.forEach(countRank(score));
console.log(score);
DEBUG && console.log(score);
const results = [...Object.values(score)].map(obj => {
try {
@ -976,7 +976,7 @@ export default Archivist;
}
});
results.sort(({score:scoreA}, {score:scoreB}) => scoreB-scoreA);
console.log(results);
DEBUG && console.log(results);
const resultIds = results.map(({id}) => id);
return resultIds;
}

View File

@ -95,7 +95,7 @@ export function trilight(query, doc, {
/* 0 is no maxLength */
maxLength: maxLength = 0,
ngramSize: ngramSize = 3,
minSegmentGap: minSegmentGap = 20,
/*minSegmentGap: minSegmentGap = 20,*/
maxSegmentSize: maxSegmentSize = 140,
} = {}) {
query = Array.from(query);
@ -115,7 +115,7 @@ export function trilight(query, doc, {
return idx;
}, {});
const qtris = query.reduce(getFragmenter(ngramSize, {overlap:true}), []);
const entries = qtris.reduce((E, {offset, text}, qi) => {
const entries = qtris.reduce((E, {text}, qi) => {
const counts = index[text];
if ( counts ) {
counts.forEach(di => {
@ -129,7 +129,7 @@ export function trilight(query, doc, {
let lastQi;
let lastDi;
let run;
const runs = entries.reduce((R, {text,qi,di}, ei) => {
const runs = entries.reduce((R, {text,qi,di}) => {
if ( ! run ) {
run = {
tris: [text],
@ -156,7 +156,6 @@ export function trilight(query, doc, {
}, []);
let lastRun;
const gaps = runs.reduce((G, run) => {
const {tris, qi, di, length} = run;
if ( lastRun ) {
const gap = {runs: [lastRun, run], gap: run.di - (lastRun.di + lastRun.length)};
G.push(gap);

View File

@ -7,7 +7,7 @@ import {
say, sleep, APP_ROOT
} from './common.js';
import Archivist from './archivist.js';
import {trilight, highlight} from './highlighter.js';
import {trilight, /*highlight*/} from './highlighter.js';
const SITE_PATH = path.resolve(APP_ROOT, '..', 'public');