Hi,

Thanks! I think there should be a more generic way to set Lucene
options / fulltext options. What about:

FTL_SET_OPTION(keyString, valueString) (and later on
FT_SET_OPTION(keyString, valueString))

Currently you only need one option: FTL_SET_OPTION('stopWords', '')
but later on new options for analyzer class and so on could be added.
The setting should be persisted, that means it should 'survive'
restarts. See also FullText.setIgnoreList.

If you have time, it would be great if you could write a patch, if not
I will add it to the roadmap (I'm sorry I can't implement it right
now, I don't have enough time). If you want to do that, see
http://www.h2database.com/html/build.html#providing_patches

Regards,
Thomas



On Mon, Oct 5, 2009 at 1:41 PM, nick betteridge
<[email protected]> wrote:
>
> Thanks Thomas - you're right of course. I just read through the lucene
> src and the stop-list includes 'a'.
>
> I just tried out a mod to FullTextLucene which provides a switch between
> the standard stop list and no stop list (below). If you would like this
> as a patch then please don't hesitate to ask.
>
> Thanks again
>
> Nick
>
>
>
>
>
>
>
>
> import java.util.HashSet;
>
>    private static boolean isStandardStopList = true;
>
>    //## Java 1.4 begin ##
>    public static void initNoStopList(Connection conn) throws SQLException {
>        isStandardStopList = false;
>        init(conn);
>    }
>    //## Java 1.4 end ##
>
>    private static Analyzer getLucerneAnalyser() {
>        if (isStandardStopList)
>            return new StandardAnalyzer();
>        else
>            return new StandardAnalyzer(new HashSet());
>    }
>
> static IndexModifier getIndexModifier(Connection conn) throws SQLException {
> ...
> Analyzer analyzer = getLucerneAnalyser();
> ...
> }
>
>
> private static ResultSet search(Connection conn, String text, int limit,
> int offset, boolean data) throws SQLException {
> ...
> Analyzer analyzer = getLucerneAnalyser();
> ...
> }
>
>
>
>
> Thomas Mueller wrote:
>> Hi,
>>
>> I guess that 'a' is a stop-word for Lucene (very common English word)
>> and is ignored, but I'm not sure. You should check with Lucene.
>>
>> Regards,
>> Thomas
>>
>> On Sat, Oct 3, 2009 at 12:22 PM, Buzz <[email protected]> wrote:
>>
>>> Hi
>>>
>>> I'm not too sure whether this problem is due to my inexperience with
>>> lucene or whether there is an issue with H2.
>>>
>>> I have a simple create table, insert strings, search for words with
>>> wildcard.
>>>
>>> The data:
>>> a
>>> ab
>>> abc
>>> abcd
>>> abcde
>>> abb
>>> acc
>>> add
>>> aee
>>>
>>> If I do a search for 'ab*' (limit 5) then I get ab .. abb
>>> If I do a search for 'ac*' (limit 5) then I get acc
>>>
>>> However, if I do a search for 'a*' (limit 5) then I get ab .. abb ->
>>> ie no 'a'
>>>
>>> Is my seach expression wrong?
>>>
>>> Nick
>>>
>>>
>>>        Class.forName("org.h2.Driver");
>>>
>>>
>>>        Connection conn = DriverManager.getConnection
>>> ("jdbc:h2:file:db_test/db_test", "sa", "");
>>>        Statement stat = conn.createStatement();
>>>
>>>        stat.execute("CREATE ALIAS IF NOT EXISTS FTL_INIT FOR
>>> \"org.h2.fulltext.FullTextLucene.init\"");
>>>        stat.execute("CALL FTL_INIT()");
>>>        stat.execute("CREATE TABLE TEST_DB(ID INT PRIMARY KEY
>>> AUTO_INCREMENT, KEY INT, WORD VARCHAR, TYPE CHAR, DESC VARCHAR)");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('a')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('ab')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('abc')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('abcd')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('abcde')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('abb')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('acc')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('add')");
>>>        stat.execute("INSERT INTO TEST_DB (WORD) VALUES('aee')");
>>>        stat.execute("CALL FTL_CREATE_INDEX('PUBLIC', 'TEST_DB',
>>> NULL)");
>>>
>>>        ResultSet rs = stat.executeQuery("SELECT T.* FROM
>>> FTL_SEARCH_DATA('a*', 5, 0) FT, TEST_DB T WHERE FT.TABLE='TEST_DB' AND
>>> T.ID=FT.KEYS[0]");
>>>
>>>        while (rs.next()) {
>>>            String word = rs.getString("WORD");
>>>            System.out.println("word " + word);
>>>        }
>>>
>>>        conn.close();
>>>
>>>
>>
>> >
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to