jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chetan Mehrotra (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OAK-3156) Lucene suggestions index definition can't be restricted to a specific type of node
Date Wed, 29 Jul 2015 08:41:04 GMT

     [ https://issues.apache.org/jira/browse/OAK-3156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Chetan Mehrotra updated OAK-3156:
---------------------------------
    Description: 
While performing a suggestor query like 

{code}
SELECT [rep:suggest()] as suggestion  FROM [nt:unstructured] WHERE suggest('foo')
{code}

Suggestor does not provide any result. In current implementation, [suggestions|http://jackrabbit.apache.org/oak/docs/query/lucene.html#Suggestions]
in Oak work only for index definitions for {{nt:base}} nodetype.
So, an index definition like:
{code:xml}
    <lucene-suggest
        jcr:primaryType="oak:QueryIndexDefinition"
        async="async"
        compatVersion="{Long}2"
        type="lucene">
        <indexRules jcr:primaryType="nt:unstructured">
            <nt:base jcr:primaryType="nt:unstructured">
                <properties jcr:primaryType="nt:unstructured">
                    <description
                        jcr:primaryType="nt:unstructured"
                        analyzed="{Boolean}true"
                        name="description"
                        propertyIndex="{Boolean}true"
                        useInSuggest="{Boolean}true"/>
                </properties>
            </nt:base>
        </indexRules>
    </lucene-suggest>
{code}
works, but if we change nodetype to {{nt:unstructured}} like:
{code:xml}
    <lucene-suggest
        jcr:primaryType="oak:QueryIndexDefinition"
        async="async"
        compatVersion="{Long}2"
        type="lucene">
        <indexRules jcr:primaryType="nt:unstructured">
            <nt:unstructured jcr:primaryType="nt:unstructured">
                <properties jcr:primaryType="nt:unstructured">
                    <description
                        jcr:primaryType="nt:unstructured"
                        analyzed="{Boolean}true"
                        name="description"
                        propertyIndex="{Boolean}true"
                        useInSuggest="{Boolean}true"/>
                </properties>
            </nt:base>
        </indexRules>
    </lucene-suggest>
{code}
, it won't work.

The issue is that suggestor implementation essentially is passing a pseudo row with path=/.:
{code:title=LucenePropertyIndex.java}
    private boolean loadDocs() {
...
                        queue.add(new LuceneResultRow(suggestedWords));
...
{code}
and
{code:title=LucenePropertyIndex.java}
        LuceneResultRow(Iterable<String> suggestWords) {
            this.path = "/";
            this.score = 1.0d;
            this.suggestWords = suggestWords;
        }
{code}
Due to path being set to "/", {{SelectorImpl}} later filters out the result as {{rep:root}}
(primary type of "/") isn't a {{nt:unstructured}}.

  was:
In current implementation, [suggestions|http://jackrabbit.apache.org/oak/docs/query/lucene.html#Suggestions]
in Oak work only for index definitions for {{nt:base}} nodetype.
So, an index definition like:
{code:xml}
    <lucene-suggest
        jcr:primaryType="oak:QueryIndexDefinition"
        async="async"
        compatVersion="{Long}2"
        type="lucene">
        <indexRules jcr:primaryType="nt:unstructured">
            <nt:base jcr:primaryType="nt:unstructured">
                <properties jcr:primaryType="nt:unstructured">
                    <description
                        jcr:primaryType="nt:unstructured"
                        analyzed="{Boolean}true"
                        name="description"
                        propertyIndex="{Boolean}true"
                        useInSuggest="{Boolean}true"/>
                </properties>
            </nt:base>
        </indexRules>
    </lucene-suggest>
{code}
works, but if we change nodetype to {{nt:unstructured}} like:
{code:xml}
    <lucene-suggest
        jcr:primaryType="oak:QueryIndexDefinition"
        async="async"
        compatVersion="{Long}2"
        type="lucene">
        <indexRules jcr:primaryType="nt:unstructured">
            <nt:unstructured jcr:primaryType="nt:unstructured">
                <properties jcr:primaryType="nt:unstructured">
                    <description
                        jcr:primaryType="nt:unstructured"
                        analyzed="{Boolean}true"
                        name="description"
                        propertyIndex="{Boolean}true"
                        useInSuggest="{Boolean}true"/>
                </properties>
            </nt:base>
        </indexRules>
    </lucene-suggest>
{code}
, it won't work.

The issue is that suggestor implementation essentially is passing a pseudo row with path=/.:
{code:title=LucenePropertyIndex.java}
    private boolean loadDocs() {
...
                        queue.add(new LuceneResultRow(suggestedWords));
...
{code}
and
{code:title=LucenePropertyIndex.java}
        LuceneResultRow(Iterable<String> suggestWords) {
            this.path = "/";
            this.score = 1.0d;
            this.suggestWords = suggestWords;
        }
{code}
Due to path being set to "/", {{SelectorImpl}} later filters out the result as {{rep:root}}
(primary type of "/") isn't a {{nt:unstructured}}.


> Lucene suggestions index definition can't be restricted to a specific type of node
> ----------------------------------------------------------------------------------
>
>                 Key: OAK-3156
>                 URL: https://issues.apache.org/jira/browse/OAK-3156
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene
>            Reporter: Vikas Saurabh
>         Attachments: LuceneIndexSuggestionTest.java
>
>
> While performing a suggestor query like 
> {code}
> SELECT [rep:suggest()] as suggestion  FROM [nt:unstructured] WHERE suggest('foo')
> {code}
> Suggestor does not provide any result. In current implementation, [suggestions|http://jackrabbit.apache.org/oak/docs/query/lucene.html#Suggestions]
in Oak work only for index definitions for {{nt:base}} nodetype.
> So, an index definition like:
> {code:xml}
>     <lucene-suggest
>         jcr:primaryType="oak:QueryIndexDefinition"
>         async="async"
>         compatVersion="{Long}2"
>         type="lucene">
>         <indexRules jcr:primaryType="nt:unstructured">
>             <nt:base jcr:primaryType="nt:unstructured">
>                 <properties jcr:primaryType="nt:unstructured">
>                     <description
>                         jcr:primaryType="nt:unstructured"
>                         analyzed="{Boolean}true"
>                         name="description"
>                         propertyIndex="{Boolean}true"
>                         useInSuggest="{Boolean}true"/>
>                 </properties>
>             </nt:base>
>         </indexRules>
>     </lucene-suggest>
> {code}
> works, but if we change nodetype to {{nt:unstructured}} like:
> {code:xml}
>     <lucene-suggest
>         jcr:primaryType="oak:QueryIndexDefinition"
>         async="async"
>         compatVersion="{Long}2"
>         type="lucene">
>         <indexRules jcr:primaryType="nt:unstructured">
>             <nt:unstructured jcr:primaryType="nt:unstructured">
>                 <properties jcr:primaryType="nt:unstructured">
>                     <description
>                         jcr:primaryType="nt:unstructured"
>                         analyzed="{Boolean}true"
>                         name="description"
>                         propertyIndex="{Boolean}true"
>                         useInSuggest="{Boolean}true"/>
>                 </properties>
>             </nt:base>
>         </indexRules>
>     </lucene-suggest>
> {code}
> , it won't work.
> The issue is that suggestor implementation essentially is passing a pseudo row with path=/.:
> {code:title=LucenePropertyIndex.java}
>     private boolean loadDocs() {
> ...
>                         queue.add(new LuceneResultRow(suggestedWords));
> ...
> {code}
> and
> {code:title=LucenePropertyIndex.java}
>         LuceneResultRow(Iterable<String> suggestWords) {
>             this.path = "/";
>             this.score = 1.0d;
>             this.suggestWords = suggestWords;
>         }
> {code}
> Due to path being set to "/", {{SelectorImpl}} later filters out the result as {{rep:root}}
(primary type of "/") isn't a {{nt:unstructured}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message