You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by jascpaint <Vi...@dsto.defence.gov.au> on 2008/06/25 04:24:15 UTC

Similarity search question

Hi all,
I am currently testing out similarity search and rep:similar function as per
http://wiki.apache.org/jackrabbit/SimilaritySearch. However I keep getting
javax.jcr.query.InvalidQueryException: Unsupported function: rep:similar

Could anyone please tell me what I am doing wrong here?

I use Jackrabbit 1.4.4 and queries I used are:
Query q = qm.createQuery ("//*[rep:similar(., '/test.txt/jcr:content')]",
Query.XPATH); 
and
Query q = qm.createQuery ("//element(*, nt:resource)[rep:similar(.,
'/test.txt/jcr:content')]", Query.XPATH);

-- 
View this message in context: http://www.nabble.com/Similarity-search-question-tp18103715p18103715.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Similarity search question

Posted by Marcel Reutegger <ma...@gmx.net>.
jascpaint wrote:
> Just a question on what makes jcr:content nodes similar. Does it work on
> percentage? As in what is the percentage of terms that appear in both
> content nodes for them to consider similar?

see: http://wiki.apache.org/jackrabbit/SimilaritySearch

and also: 
http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/similar/MoreLikeThis.html

that's the underlying lucene class jackrabbit uses.

regards
  marcel

Re: Similarity search question

Posted by jascpaint <Vi...@dsto.defence.gov.au>.
Yes, i finally figured out that I didn't update the jackrabbit-webapp.war
with the newest jackrabbit. Done that now. All is working. Thanks!

Just a question on what makes jcr:content nodes similar. Does it work on
percentage? As in what is the percentage of terms that appear in both
content nodes for them to consider similar?



Marcel Reutegger wrote:
> 
> Hi,
> 
> please double check that you are in fact using jackrabbit 1.4.4.
> 
> it looks like your class path still contains an older jackrabbit version.
> 
> regards
>   marcel
> 
> jascpaint wrote:
>> Hi Alex,
>> That is exactly what I have. I could do search based on keywords or
>> phrases
>> and display excerpts using rep:excerpt function, with the keyword or
>> phrase
>> being highlighted on return. I attached the workspace.xml here.
>> 
>> http://www.nabble.com/file/p18124304/workspace.xml workspace.xml 
>> 
>> 
>> Alexander Klimetschek wrote:
>>> Hi!
>>>
>>>> Does it look right to you?
>>> No. The mentioned query handler = search index. See
>>> http://wiki.apache.org/jackrabbit/Search for a complete overview of
>>> parameters. The SearchIndex element of your workspace.xml should look
>>> like this:
>>>
>>>    <SearchIndex
>>> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>>>        
>>>    </SearchIndex>
>>>
>>> Regards,
>>> Alex
>>>
>>> -- 
>>> Alexander Klimetschek
>>> alexander.klimetschek@day.com
>>>
>>>>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<
>>> ----------------------------< alexander.klimetschek@day.com >----------
>>> Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
>>> CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
>>> ---------------------------------------< http://www.day.com
>>>> -----------------
>>> Xing: http://www.xing.com/go/invite/3268380.32d2d4
>>> LinkedIn: http://www.linkedin.com/in/klimetschek
>>> Blog: http://weblogs.goshaky.com/weblogs/alexkli/
>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Similarity-search-question-tp18103715p18230438.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Similarity search question

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,

please double check that you are in fact using jackrabbit 1.4.4.

it looks like your class path still contains an older jackrabbit version.

regards
  marcel

jascpaint wrote:
> Hi Alex,
> That is exactly what I have. I could do search based on keywords or phrases
> and display excerpts using rep:excerpt function, with the keyword or phrase
> being highlighted on return. I attached the workspace.xml here.
> 
> http://www.nabble.com/file/p18124304/workspace.xml workspace.xml 
> 
> 
> Alexander Klimetschek wrote:
>> Hi!
>>
>>> Does it look right to you?
>> No. The mentioned query handler = search index. See
>> http://wiki.apache.org/jackrabbit/Search for a complete overview of
>> parameters. The SearchIndex element of your workspace.xml should look
>> like this:
>>
>>    <SearchIndex
>> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>>        
>>    </SearchIndex>
>>
>> Regards,
>> Alex
>>
>> -- 
>> Alexander Klimetschek
>> alexander.klimetschek@day.com
>>
>>>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<
>> ----------------------------< alexander.klimetschek@day.com >----------
>> Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
>> CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
>> ---------------------------------------< http://www.day.com
>>> -----------------
>> Xing: http://www.xing.com/go/invite/3268380.32d2d4
>> LinkedIn: http://www.linkedin.com/in/klimetschek
>> Blog: http://weblogs.goshaky.com/weblogs/alexkli/
>>
>>
> 


Re: Similarity search question

Posted by jascpaint <Vi...@dsto.defence.gov.au>.
Hi Alex,
That is exactly what I have. I could do search based on keywords or phrases
and display excerpts using rep:excerpt function, with the keyword or phrase
being highlighted on return. I attached the workspace.xml here.

http://www.nabble.com/file/p18124304/workspace.xml workspace.xml 


Alexander Klimetschek wrote:
> 
> Hi!
> 
>> Does it look right to you?
> 
> No. The mentioned query handler = search index. See
> http://wiki.apache.org/jackrabbit/Search for a complete overview of
> parameters. The SearchIndex element of your workspace.xml should look
> like this:
> 
>    <SearchIndex
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>        
>    </SearchIndex>
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
>>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<
> 
> ----------------------------< alexander.klimetschek@day.com >----------
> Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
> CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
> ---------------------------------------< http://www.day.com
> >-----------------
> 
> Xing: http://www.xing.com/go/invite/3268380.32d2d4
> LinkedIn: http://www.linkedin.com/in/klimetschek
> Blog: http://weblogs.goshaky.com/weblogs/alexkli/
> 
> 

-- 
View this message in context: http://www.nabble.com/Similarity-search-question-tp18103715p18124304.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Similarity search question

Posted by Alexander Klimetschek <ak...@day.com>.
Hi!

> Does it look right to you?

No. The mentioned query handler = search index. See
http://wiki.apache.org/jackrabbit/Search for a complete overview of
parameters. The SearchIndex element of your workspace.xml should look
like this:

   <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
       <param name="supportHighlighting" value="true"/>
   </SearchIndex>

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<

----------------------------< alexander.klimetschek@day.com >----------
Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
---------------------------------------< http://www.day.com >-----------------

Xing: http://www.xing.com/go/invite/3268380.32d2d4
LinkedIn: http://www.linkedin.com/in/klimetschek
Blog: http://weblogs.goshaky.com/weblogs/alexkli/

Re: Similarity search question

Posted by jascpaint <Vi...@dsto.defence.gov.au>.
Thanks for a quick reply, Alex.
Yes, I've changed both in repository.xml and workspace.xml. Here is how my
workspace.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<Workspace name="default">
    <!--
    virtual file system of the workspace:
    class: FQN of class implementing FileSystem interface
    -->
    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
      
    </FileSystem>
    <!--
    persistence of the workspace:
    class: FQN of class implementing PersistenceManager interface
    -->
    <PersistenceManager
class="org.apache.jackrabbit.core.state.obj.ObjectPersistenceManager"/>
    <!--
    Search index and the file system it uses.
    -->
    <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
      
      
       
    </SearchIndex>
  </Workspace>

Does it look right to you?


Alexander Klimetschek wrote:
> 
> Are you sure you added  to the query handler in your workspace.xml? Maybe
> you
> changed only repository.xml (whose Workspace section acts only as a
> template for new workspaces).... common glitch ;-)
> 
> Regards,
> Alex
> 
> On Tue, Jun 24, 2008 at 10:24 PM, jascpaint
> <Vi...@dsto.defence.gov.au> wrote:
>>
>> Hi all,
>> I am currently testing out similarity search and rep:similar function as
>> per
>> http://wiki.apache.org/jackrabbit/SimilaritySearch. However I keep
>> getting
>> javax.jcr.query.InvalidQueryException: Unsupported function: rep:similar
>>
>> Could anyone please tell me what I am doing wrong here?
>>
>> I use Jackrabbit 1.4.4 and queries I used are:
>> Query q = qm.createQuery ("//*[rep:similar(., '/test.txt/jcr:content')]",
>> Query.XPATH);
>> and
>> Query q = qm.createQuery ("//element(*, nt:resource)[rep:similar(.,
>> '/test.txt/jcr:content')]", Query.XPATH);
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Similarity-search-question-tp18103715p18103715.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Similarity-search-question-tp18103715p18105152.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: Similarity search question

Posted by Alexander Klimetschek <ak...@day.com>.
Are you sure you added <param name="supportHighlighting"
value="true"/> to the query handler in your workspace.xml? Maybe you
changed only repository.xml (whose Workspace section acts only as a
template for new workspaces).... common glitch ;-)

Regards,
Alex

On Tue, Jun 24, 2008 at 10:24 PM, jascpaint
<Vi...@dsto.defence.gov.au> wrote:
>
> Hi all,
> I am currently testing out similarity search and rep:similar function as per
> http://wiki.apache.org/jackrabbit/SimilaritySearch. However I keep getting
> javax.jcr.query.InvalidQueryException: Unsupported function: rep:similar
>
> Could anyone please tell me what I am doing wrong here?
>
> I use Jackrabbit 1.4.4 and queries I used are:
> Query q = qm.createQuery ("//*[rep:similar(., '/test.txt/jcr:content')]",
> Query.XPATH);
> and
> Query q = qm.createQuery ("//element(*, nt:resource)[rep:similar(.,
> '/test.txt/jcr:content')]", Query.XPATH);
>
> --
> View this message in context: http://www.nabble.com/Similarity-search-question-tp18103715p18103715.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com