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

Rick Hillegas updated DERBY-590:
--------------------------------

    Attachment: derby-590-09-aa-localeSensitiveAnalysis.diff

Attaching derby-590-09-aa-localeSensitiveAnalysis.diff. This patch adds support 
for locale-sensitive searching.

I was in the middle of this patch when Mike and I agreed on a new directory 
scheme. This patch uses the old directory scheme. In a later patch, I will move 
the code into the new scheme.

Before describing the patch in greater detail, let me first describe the Lucene 
Analyzer interface. The Analyzer is the object which turns a block of text into 
a list of indexable terms. The Analyzer is used when you initially index text. 
The Analyzer is also used later on when you run a query. It is expected that 
you will use the same Analyzer to parse the text when you index it and when you 
query it. Lucene supplies a number of locale-sensitive Analyzers. They are 
listed in the LuceneUtils class included in this patch.

This patch adds a new argument to the createIndex() and updateIndex() 
procedures. The new argument is a (possibly null) method name. It is the name 
of a static, public, no-arg method which instantiates a Lucene Analyzer. If you 
leave this argument null, then it defaults to 
org.apache.derby.optional.LuceneUtils.defaultAnalyzer(). That method looks for 
a Lucene Analyzer which matches the database Locale. If a good match can't be 
found, then the method returns StandardAnalyzer, the Analyzer which the plugin 
has been using up until now.

The tests return slightly different (and I think better) results now that they 
use a locale-sensitive Analyzer.

At this point, the Lucene index needs to be more stateful. In particular, the 
index needs to know what Analyzer created it so that the same Analyzer can be 
re-used at query time. So this patch introduces a derby-lucene.properties file. 
This file is added to the index directory by createIndex() and it is re-written 
by updateIndex(). Right now, the properties file contains the following 
information:

o The version number of the Lucene software which created the index.

o The timestamp when the index was created/updated.

o The name of the static method which instantiated the Analyzer.

o The name of the Analyzer which was instantiated.

This extra information is added to the ResultSet returned by the listIndexes() 
table function.



Touches the following files:

------------

A       java/engine/org/apache/derby/optional
A       java/engine/org/apache/derby/optional/LuceneUtils.java
A       java/engine/org/apache/derby/optional/build.xml
M       java/engine/build.xml

New utility class, to be part of the public api eventually. Right now, this 
class provides support for looking up locale-sensitive Analyzers. We may think 
of other utility methods to add later on. I have not exposed this class in the 
public api yet. That will happen at the end when the plugin is ready to be 
documented and exposed to users.

------------

M       java/engine/org/apache/derby/impl/optional/lucene/LuceneQueryVTI.java
M       java/engine/org/apache/derby/impl/optional/lucene/LuceneSupport.java
M       
java/engine/org/apache/derby/impl/optional/lucene/LuceneListIndexesVTI.java
M       java/engine/org/apache/derby/impl/optional/lucene/build.xml

The argument signatures of createIndex() and updateIndex() have changed. The 
signature of the table returned by listIndexes() has changed too.

------------

M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportPermsTest.java
M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneSupportTest.java
M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/LuceneCollationTest.java
M       build.xml

The tests reflect the new signatures. New tests have been added for the new 
funtionality. The decorator for LuceneSupportPermsTest now explicitly sets the 
Locale to en_US. Hopefully the decorators will compose correctly when run on 
machines having different default locales.


> How to integrate Derby with Lucene API?
> ---------------------------------------
>
>                 Key: DERBY-590
>                 URL: https://issues.apache.org/jira/browse/DERBY-590
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation, SQL
>            Reporter: Abhijeet Mahesh
>              Labels: derby_triage10_11
>         Attachments: derby-590-01-ag-publicAccessToLuceneRoutines.diff, 
> derby-590-01-ah-publicAccessToLuceneRoutines.diff, 
> derby-590-01-am-publicAccessToLuceneRoutines.diff, 
> derby-590-02-aa-cleanupFindbugsErrors.diff, 
> derby-590-03-aa-removeTestingDiagnostic.diff, 
> derby-590-04-aa-removeIDFromListIndexes.diff, 
> derby-590-05-aa-accessDeclaredMembers.diff, 
> derby-590-06-aa-suppressAccessChecks.diff, 
> derby-590-07-aa-accessClassInPackage.sun.misc.diff, 
> derby-590-08-aa-omitLuceneFlag.diff, 
> derby-590-09-aa-localeSensitiveAnalysis.diff, lucene_demo.diff, 
> lucene_demo_2.diff
>
>
> In order to use derby with lucene API what should be the steps to be taken? 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to