mulgara - semantic store

skip navigation


Full-Text Models

Normally in Mulgara, searches for literal values in models only succeed when there is an exact match.

Lucene is a full-text search engine integrated into Mulgara by treating the Lucene index as a model. With full-text models, searches for literal values in models succeed when there is a partial match.

The following sections outline how to create, modify, query full-text models, plus the limitations of full-text models.

Visit the Lucene System Properties Web site for information on the performance and operational properties you can set.


Creating Full-Text Models

Use the create command with an optional type argument of <> in addition to the model name.

For example, to create the full-text model #foo:

create <rmi://> <>;

Note - Specifying no type at all creates a normal Mulgara model.

Full-text models are removed in exactly the same way as normal models. For example:

drop <rmi://>;


Modifying Full-Text Models

As with normal models, use the insert command to insert statements into a full-text model.

When inserting statements into a full-text model, the object is the text that is specially indexed for partial matching. If the object is a literal, the text of the literal is indexed. Indexing literals into a model uses the same as for any other model. For example:

insert <>
<> 'Document title'
into <rmi://>;

If the object is a resource, the resource is converted into a URL, the URL is accessed by the server, and the content of the URL is indexed. The resource must have either a http: or file: protocol, or the insert fails, sometimes without generating an error. For example:

insert <>
into <rmi://>;

To perform full-text searching on literals stored in a normal model, the contents of the normal model must be copied into a full-text model. The following example shows how the document titles stored in the normal model #data are copied into the full-text model #foo.

insert select $url <> $title
from <rmi://>
where $url <> $title
into <rmi://>;

If a statement is inserted into a full-text model and the server determines that the MIME type of the document is text/html, then the HTML tags are filtered out before indexing.

Note - The ability of Mulgara to correctly identify HTML input is limited, and only works when fetching a resource via HTTP from a web server that accurately reports the content type.

Use the delete command to delete text from full-text models.


Querying Full-Text Models

Queries on full-text models work differently on normal models, as follows:

Given the full-text model #foo populated in the previous section, the following query returns titles with the words "duty" and "care" in the title, as well as an indication of the quality of the match:

select $url $title $score
from <rmi://>
where $url <> $title
and $url <> '+duty +care'
in <rmi://>;

Note - In the example above, the join is performed across the $url column, and the second where constraint is only executed against the full-text model #foo.

The index files for full-text models are stored in the server1/fulltext directory.


Limitations of Full-Text Models

Full-text models are an attempt to make a text index act like a Mulgara model, allowing both exact and partial matching to be mixed within queries. Full-text models have the following limitations:

Valid XHTML 1.0 TransitionalValid CSS 3.0!