Improves ordering of search results

Modifies documents.search to return a context snippet and search ranking
Displays context snipped on search results screen
This commit is contained in:
Tom Moor
2018-08-04 18:32:56 -07:00
parent 96348ced38
commit e192bcbaee
10 changed files with 121 additions and 63 deletions

View File

@@ -222,17 +222,12 @@ class DocumentScene extends React.Component<Props> {
};
onSearchLink = async (term: string) => {
const resultIds = await this.props.documents.search(term);
const results = await this.props.documents.search(term);
return resultIds.map((id, index) => {
const document = this.props.documents.getById(id);
if (!document) return {};
return {
title: document.title,
url: document.url,
};
});
return results.map((result, index) => ({
title: result.document.title,
url: result.document.url,
}));
};
onClickLink = (href: string) => {