Class: Index

WinJSContrib.Search. Index

This class is the heart of the search engine. operations performed by this object are synchronous but exposes as promises. This way Index is almost interchangeable with WinJSContrib.Search.IndexWorkerProxy

new Index(name, definition)

Search index

Parameters:
Name Type Description
name string

index name

definition WinJSContrib.Search.IndexDefinition

index definition

Source:

Methods

add(obj, definition) → {WinJS.Promise}

add an object to index

Parameters:
Name Type Description
obj Object

object to index

definition WinJSContrib.Search.IndexDefinition

index definition (optional), use index's definition if not defined

Source:
Returns:
Type
WinJS.Promise

addRange(items) → {WinJS.Promise}

add an array of objects to index

Parameters:
Name Type Description
items Array

items array

Source:
Returns:
Type
WinJS.Promise

checkWord(word)

Check if a word is a stopword

Parameters:
Name Type Description
word string
Source:

clear() → {WinJS.Promise}

clear index

Source:
Returns:
Type
WinJS.Promise

count() → {WinJS.Promise}

get number of items in index

Source:
Returns:
Type
WinJS.Promise

define()

set index definition

Source:

dispose()

release index

Source:

export()

export index

Source:

load() → {WinJS.Promise}

load index from storage

Source:
Returns:
Type
WinJS.Promise

loadData()

load index from serialized string

Source:

processText(text)

prepare a text for search by applying stemming and tokenizing text

Parameters:
Name Type Description
text string
Source:

save() → {WinJS.Promise}

save index to storage

Source:
Returns:
Type
WinJS.Promise

search index

Parameters:
Name Type Description
querytext string
Source:
Returns:

search result

Type
WinJS.Promise

tokenize(text)

split a string into words

Parameters:
Name Type Description
text string
Source:

toString()

serialize index to string

Source: