[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-133) Allow ovrriding DefaultSimilarity for indexing and searching

Nick Vincent (JIRA) noreply at atlassian.com
Thu Feb 14 09:24:33 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29524 ] 

Nick Vincent commented on HSEARCH-133:
--------------------------------------

I've attached a patch that I've created which addresses this issue.  It introduces a new annotation @Similarity which can be used at the class level to specify which similarity implementation to use for the directory.  It will pick up any conflicts where two different similarity implementations are used on the same directory at runtime if a mismatch occurs.

The solution also feeds into HSEARCH-136 in that as part of the patch it makes it possible to close searchers rather than readers, and also to retrieve all the readers for a searcher no matter how it is constructed.  A small amount of introspection is used here to retrieve the subreaders of a MultiReader.  I note that in Lucene 2.3 this property has been made protected, so the introspection will no longer be necessary.  I also notice that HSEARCH-136 has been resolved so I hope that the changes I have made are compatible.

My patch makes changes to quite a lot of core classes, but seems to work in my dev environment and hopefully is reasonably efficient as regards any penalty to search performance.  Unfortunately I haven't had time to actually force it to use MultiReaders and validate the results are as expected as that's not the use case we are using, although I have checked the code paths for optimising the number of MultiReaders created.

> Allow ovrriding DefaultSimilarity for indexing and searching
> ------------------------------------------------------------
>
>                 Key: HSEARCH-133
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-133
>             Project: Hibernate Search
>          Issue Type: New Feature
>          Components: engine, query
>    Affects Versions: 3.0.1
>            Reporter: John Griffin
>            Assignee: John Griffin
>         Attachments: similaritypatch.txt
>
>
> Ability to override DefaultSimilarity for indexing and searching should be implemented. Access is necessary in both places because changing only one and then querying has undefined results as far as scores are concerned.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list