Lucene4 Plug-in (deprecated)

compared with
Version 9 by Reneta Popova
on Sep 18, 2014 15:21.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (17)

View Page History
This means that if the join predicate is {nolink}http://example.com/slash{nolink}, the proper query would be "+(query) +http\\:\/\/example.com\/slash:joinValue".
* also note that whatever the original FTS query is, the best is to put it in brackets, with plus in front. If you ask for
{code}"query +urn\\:join:joinValue"{code} then Lucene will return all entities that match either _query_ OR _
{code}urn\\:join:joinValue{code} which is not the intent.

h5. Optional joins

The _optionalJoins_ parameter is still there in Lucene4 as in Lucene2: entities that have the specified predicate values OR are missing the predicates completely are indexed, the rest of the entities are not. The optional joins predicate values are indexed as other predicates, in a Lucene field per predicate, which allows to search for specific values as described above in the _Additional joins_ section.
The {{optionalJoins}} parameter is still present in Lucene4. Entities that have the specified predicate values OR lack predicates completely are indexed, while the rest of the entities are not. The optional joins predicate values are indexed as the other predicates in a Lucene field per predicate, which allows to search for specific values, as described above in the Additional joins section.

For example, if we create an index like this:
For example, if you create the following index:
{code}
luc4:my-index-name luc4:createIndex "predicates=urn:label;optionalJoins=urn:join,ok"
and then insert some entities:
{code}
# the entity bellow will be indexed because it has a matching value for <urn:join>
<entity:will-be-indexed> <urn:label> "this entity will be indexed"
<entity:will-be-indexed> <urn:join> "ok"

# the entity below will be indexed because it's lacking it lacks the predicate completely
<entity:will-be-indexed-too> <urn:label> "this entity will be indexed too"

{code}

Querying on urn:join is possible as in the additional joins, in the example above:
{code}
# will return only the entities that had have this specific value for the optional join predicate
?entity luc4:my-index-name "words... +urn\\:join:ok"
{code}

Entities that don't have the optional join predicate get a default value indexed in that field name in order to be able to filter for those too. The default default value is _OPTIONALJOINDEFAULT_ and can be set by using the _optionalJoinDefaults_ index option. For example, with the above entities, searching for "words... \+urn
Entities that do not have the optional join predicate get a default value. The default value is {{OPTIONALJOINDEFAULT}} and can be set by using the {{optionalJoinDefaults}} index option. For example, with the above entities, searching for
{code}"words...+urn\\:join:OPTIONALJOINDEFAULT"{code}
:join:OPTIONALJOINDEFAULT" will return only _<entity:will-be-indexed-too>_.
will return only
{code}<entity:will-be-indexed-too>{code}

We could create the index like this to specify different default value for _<urn:join>_:
To specify different default values for _<urn:join>_, create such an index:
{code}
luc4:my-index-name luc4:createIndex "predicates=urn:label;optionalJoins=urn:join,ok;optionalJoinDefaults=urn:join,newdefault"
{code}

Optional join predicate values are indexed, but not tokenized - that tokenised, which means that queries for them should match exactly.

h3. Search options