No results.
- Prev
-
- Next
#{examplesWidget}
|]) `LT.append`
-- generate javascript
-- XXX TODO: refactor all this messy javascript into a hunt-client-js library
renderJavascriptUrl (\_ _ -> "") [julius|
|]
quickstart :: LT.Text
quickstart =
(renderHtml . defaultLayout $ [xshamlet|
Quickstart
Query Interface
1. About Contexts
Contexts
The term context has already been introduced in the Holumbus framework. It isused to classify and distinguishes indexed information.
In an analogy to databases, a context could be seen as a table. It has a unique name and a configured behaviour. The configuration is made with the help of the context schema.
Documents are always indexed with respect to at least one context. It is also possible to create and remove contexts during runtime.
Each context is created with an individual schema.
Context Schema
Each context has a corresponding context schema. The schema defines the contexts behaviour. That includes:
- Definition of how the input should be split up into words.
- Definition of how these words should be preprocessed and normalized.
- Definition of the index type to use (text, date, geolocation, ...).
Context Types
Each index implementation is integrated into the search engine as a context type.
The search engine is started with a list of valid types. Only a context schema created with one of those valid types is a valid schema.
The context type contains information how the index implementation should be used.
This includes:
-
Splitting Words
When inserting a big text into a context, some meta information is required, how this large text should be split up into words. The context type gives a default configuration how this task should be handled. The default should fit in most cases, else it could be overwritten by the context schema.
-
Validation
Each implementation of an index-structure handles data differently. A basic validation of the index key needs to be performed before insertion. For example, a numeric context type needs to make sure each key is a valid number.
2. Example
Scenario Introduction
Consider the maintaining of a blog-like news website. Each blog entry contains a subject, the date of publication, the content and the location, where the news happened.
The page has become rather large and it is necessary to provide a way to search and filter the articles.
Context Creation
The first step, when building a Hunt search engine application, is to think about the necessary contexts. There are four fields of information stored for an article. The publishing date should be a context by itself and is a perfect match for the date context type. The location could be stored in location contexts. The obvious choice for the articles’ content is the text type. One could use a single context for the subject and the content.
In this case it is a more flexible approach, to keep the subject and content separate. By doing so, it is possible to assign a higher weight to the subject. This means, that the document in the result set gets a ranking boost, if a search term occurs in the subject line. A blog entry “Introduction to Functors” would rank higher in a search for “functor” than another blog entry, where the word occurs just in the content itself.
First, let us create the four contexts:
|