|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (22)
View Page History
* {{types=<comma-separated-list-of-URIs>}} \- if specified, a white list of types will be indexed (i.e. only entities that have rdf:type equal to one of the specified URIs will be indexed);
* facets=<comma-separated-list-of-URIs> if specified, the listed predicates and their values will be indexed in the facets index
* facets=<comma-separated-list-of-URIs> if specified, the listed predicates and their values will be indexed in the facets index
* {{optionalJoins=<\|-separated-predicate-object-pairs>}} - if specified, a white list of additional optional joins to validate. Supports both URIs and Literals as objects. Literals can include spaces. Sample syntax: {code}optionallJoins=urn:ontology:predicate,longer value\|urn:ontology:predicate,another longer value{code}
An entity is only indexed, if for each specified predicate it either has the predicate with one of the specified values, or it does not have the predicate. If an entity is indexed, a field for each optional join predicate is created with all values and in the case where the entity does not have the predicate a default value for the optional join predicate specified with *optionalJoinDefaults*. The value is indexed, but not tokenized, so any searches within an optional joins field should match exactly
* optionalJoinDefaults=<\|-separated-predicate-object-pairs> if specified, provide different default value to index in the field of entities that don't have the optional join predicate at all. The default for all predicates is "OPTIONALJOINDEFAULT"
* sortPredicates=<comma-separated-list-of-URIs> - predicate values that will be used for sorting at search time - only predicates specified here can be passed to \_order.by_.
* optionalJoinDefaults=<\|-separated-predicate-object-pairs> if specified, provide different default value to index in the field of entities that don't have the optional join predicate at all. The default for all predicates is "OPTIONALJOINDEFAULT"
* sortPredicates=<comma-separated-list-of-URIs> - predicate values that will be used for sorting at search time - only predicates specified here can be passed to \_order.by_.
An entity is only indexed, if for each specified predicate it either has the predicate with one of the specified values, or it does not have the predicate. If an entity is indexed, a field for each optional join predicate is created with all values. If the entity does not have the predicate, a default value for the optional join predicate specified with {{optionalJoinDefaults}} is created. The value is indexed, but not tokenized, so any searches in an optional joins field should be exact matches.
* {{optionalJoinDefaults=<\|-separated-predicate-object-pairs>}} - if specified, provide different default value to be indexed in the field of entities that do not have the optional join predicate. (The default for all predicates is *"OPTIONALJOINDEFAULT"*)
* {{sortPredicates=<comma-separated-list-of-URIs>}} - predicate values that are used for sorting during search time. Only predicates specified here can be passed to {{order.by}}.
* {{optionalJoinDefaults=<\|-separated-predicate-object-pairs>}} - if specified, provide different default value to be indexed in the field of entities that do not have the optional join predicate. (The default for all predicates is *"OPTIONALJOINDEFAULT"*)
* {{sortPredicates=<comma-separated-list-of-URIs>}} - predicate values that are used for sorting during search time. Only predicates specified here can be passed to {{order.by}}.
Examples:

h3. Query indices health
Indices might become corrupt due to disk failure or other issues. The _luc4:healthCheck_ {{luc4:healthCheck}} predicate returns a list of indices along with their health status. In the example below, ?uri will bind to
{code}

h3. Search
# Simple search - in the form
{code}?entity luc4:indexName "lucene-query"{code}
{code}?entity luc4:indexName "lucene-query"{code}
# Simple - in the form {code}?entity luc4:indexName "lucene-query"{code} Returns all matching entities' ids as the ?entity binding.
# Advanced - in the form {code}?result luc4:indexName ("lucene-query" "options"){code} Options is ;-separated list of option=value pairs. What will be bound as ?result depends on whether the options specify facet query or not. A list of all supported options:
# Advanced search - in the form
{code}?result luc4:indexName ("lucene-query" "options"){code}
The options are in a ;-separated list of option=value pairs. What will be bound as ?result, depends on whether the options specify facet query or not. The following is a list of all supported options:
|| Parameter || Value \\ || Default \\ || Comment \\ ||
| offset \\ | int \\ | 0 \\ | Returns the results starting from the specified value. \\ |
| limit \\ | int \\ | 2^31-1 \\ | Lucene query limit - the maximum number of results which to return. \\ |
| snippet.size \\ | int \\ | 250 | The size of the returned snippets. \\ |
| class \\ | string \\ | none | Hit highlights are represented with {{<span>}}. This optional parameter provides the class, i.e. {{<span class="xxx">}} \\ |
| facets \\ | string \\ | none \\ | Comma-separated A comma-separated list of facet predicates whose values to aggregate. All predicates specified here should also have been specified in the index options _facets_. {{facet}}. Passing a non-empty list of facet predicates changes the way results are returned, see fFacet examples below \\ |
| facets.limit \\ | int \\ | 2^31-1 \\ | The number of top values to return per facet predicate. For example, specifying _facets=urn:facet1,urn:facet2;facets.limit=5_ {{facets=urn:facet1,urn:facet2;facets.limit=5}} will return ten facet results in total. \\ |
| order.by \\ | string \\ | score \\ | Comma-separated list of indexed predicates. If specified the results will be ordered the value of the specified predicates, in the specified order. Values are sorted in an ascending order, to sort certain predicate's values in descending order, prepend - (minus) to it. For example _order.by=urn:predicate1,-urn:predicate2_ will sort the results by the value of urn:predicate1 ascending, then those results that have the same value in urn:predicate1 will be sorted by the value of urn:predicate2, descending. The special value _score_ (lower-case) can be used instead of a predicate to order based on the normal Lucene score (descending by default). For example "_order.by=urn:predicate,score_" will sort on urn:predicate first (ascending) and then on score, while "_order.by=score,urn:predicate_" will sort on score first and on urn:predicate second. Passing "-score" to reverse the order (from lowest to highest score) is also allowed. *NOTE*: Predicates on this list should be specified as _sortPredicates_ at index creation. Ordering by predicate not specified in _sortPredicates_ will lead to unpredictable order \\ |
# Faceted search results - for searches where _facets_ search option is specified, the search predicate (e.g. luc4:indexName) binds a single dummy blank node to its object. You must then query for _luc4:entities_ to get entities that matched the query and _luc4:facets_ to get faceted results. Example, demonstrating this and related special predicates for extra result details:
# Faceted search results - for searches where _facets_ search option is specified, the search predicate (e.g. luc4:indexName) binds a single dummy blank node to its object. You must then query for _luc4:entities_ to get entities that matched the query and _luc4:facets_ to get faceted results. Example, demonstrating this and related special predicates for extra result details:
| order.by \\ | string \\ | score \\ | A comma-separated list of indexed predicates. If specified, the results are ordered by the value of the specified predicates, in the specified order. Values are sorted in an ascending order. To sort certain predicate values in descending order, prepend - (minus) to it. For example, {{order.by=urn:predicate1,-urn:predicate2}} will sort the results by the value of {{urn:predicate1}} in an ascending order. Then, the results that have the same value in {{urn:predicate1}} will be sorted by the value of {{urn:predicate2}} in a descending order. The special value {{score}} (lower-case) can be used for ordering instead of a predicate, based on the normal Lucene score (descending by default). For example {{order.by=urn:predicate,score}} will sort {{urn:predicate}} first (in an ascending order) and then by score, while {{order.by=score,urn:predicate}} will sort first by score, and then by {{urn:predicate}}. Passing {{-score}} to reverse the order (from lowest to highest score) is also allowed. *NOTE*: Predicates on this list should be specified as {{sortPredicates}} during the creation of the index. Ordering by predicate without any specifications in {{sortPredicates}} will lead to unpredictable ordering. \\ |
# Faceted search results - for searches where the {{facets}} search option is specified, the search predicate (e.g. {{luc4:indexName}}) binds a single dummy blank node to its object. You must then query for {{luc4:entities}} to get entities that match the query and {{luc4:facets}} to get faceted results. The following is an example that demonstrates this and relates special predicates for extra result details:
# Faceted search results - for searches where the {{facets}} search option is specified, the search predicate (e.g. {{luc4:indexName}}) binds a single dummy blank node to its object. You must then query for {{luc4:entities}} to get entities that match the query and {{luc4:facets}} to get faceted results. The following is an example that demonstrates this and relates special predicates for extra result details:
{code}
PREFIX lucene4:<[http://www.ontotext.com/owlim/lucene4#]>
PREFIX lucene4:<[http://www.ontotext.com/owlim/lucene4#]>

}
{code}
{code}
Note the use of UNION to avoid the Cartesian product of the set of document and facet results, this results. This is the recommended way to retrieve both documents and facets results.
h4. Additional predicates allowed on bound search results
* ?entity [http://www.ontotext.com/lucene4#score] ?score - binds ?score to the score of the result.
* ?entity [http://www.ontotext.com/lucene4#snippet] ?snippet - binds ?snippet to the extracted snippet, with highlights.
h4. Additional predicates allowed on bound facets results
* ?facet [http://www.ontotext.com/lucene4#facetPredicate] ?predicate - binds ?predicate to the URI of the current facet predicate.
* ?facet [http://www.ontotext.com/lucene4#facetValue] ?value - binds ?value to a value of the ?predicate (and up to _facets.limit_ {{facets.limit}} values of ?predicate, ordered by the aggregate count in the result set).
* ?facet [http://www.ontotext.com/lucene4#facetCount] ?count - binds ?count to the number of entities in the result set that had have ?value as value of ?predicate.
h3. Examples
