History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILSPLUGINS-251
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Maurice Nicholson
Reporter: Jonathan Lebrun
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails Plugins

[Searchable Plugin] Oracle name

Created: 26/Feb/08 08:00 AM   Updated: 02/Apr/08 04:36 PM
Component/s: Grails-Searchable
Affects Version/s: Grails Searchable 0.3
Fix Version/s: Grails Searchable 0.5

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide
When I run my app with Oracle and Searchable Plugin, this message appears :

[create table index_aliasnotifyingcountryalias (name_ varchar2(50 char) , value_ blob , size_ number(10,0) , lf_ timestamp , deleted_ number
(1,0), primary key (name_) ) ]; nested exception is java.sql.SQLException: ORA-00972: identifier is too long

Table name : index_aliasnotifyingcountryalias is too long. May be I must create a configuration file .



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Maurice Nicholson - 26/Feb/08 03:23 PM
So you have configured a JDBC store for Compass?

Jonathan Lebrun - 27/Feb/08 08:34 AM
Yes :
<compass-core-config xmlns="http://www.opensymphony.com/compass/schema/core-config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opensymphony.com/compass/schema/core-config
http://www.opensymphony.com/compass/schema/compass-core-config.xsd">

<compass name="default">

<connection>
<jdbc dialect="org.apache.lucene.store.jdbc.dialect.OracleDialect">
<dataSourceProvider>
<driverManager url="jdbc:oracle:thin:@blable " username="myusername" password="mypassword"
driverClass="oracle.jdbc.driver.OracleDriver" />
</dataSourceProvider>
<fileEntries>
<fileEntry name="_default_">
<indexInput bufferSize="4096" />
<indexOutput bufferSize="4096" />
</fileEntry>
</fileEntries>
</jdbc>
</connection>
</compass>
</compass-core-config>


Maurice Nicholson - 01/Mar/08 04:51 PM
The name of table it's trying to create comes from the default alias for your domain class, which is typically "ALIAS" + domainClassName + "ALIAS" for historical reasons.

I've just commited a new feature (and made a release of the 0.4-SNAPSHOT version) that allows you to override the default alias with one of your choosing.

It works like this:

class MyClass {
    static searchable = {
        alias "myclass" // overrides the default alias with one you choose
        // .. other searchable mapping config if you need it
    }

    // .. properties etc
}

This should allow you to set a shorter alias than the default and therefore make the table name shorter.

Want to try it and report back?



Shay Banon - 02/Mar/08 09:10 AM
Maurice, do you think that it make sense to get back to the default alias name that Compass gives for mapped classes, which is the classname? I am guessing that you did it because there wasn't exclude-from-all feature, but I don't think a lot of people would want to do it, and this feature will be available in 2.0.

Anyhow, now with the support to control the alias name, they can put an obscure name if they choose to.


Maurice Nicholson - 02/Mar/08 09:19 AM
yes I you're absolutely right Shay!

That was reason for choosing the silly generated alias we have now.

Now people can obfuscate the alias themselves it does make more sense to use the basic class name as the default alias again.

But personally I prefer to have exclude-alias-from-all on by default, and provide an option to turn it off, so for the sake of consistency in plugin search results I would prefer to implement the two together.


Shay Banon - 02/Mar/08 10:07 AM
It is a good question if the exclude alias from all should be on by default. From what I have seen in how people use Compass, they like the ability to search for "customer" and get all the customers back. Then they can do things like: "+customer +maurice" and other advance search options.

Maurice Nicholson - 03/Mar/08 12:44 AM
With the plugin as it stands at the moment one could just do Customer.search("maurice") to achieve the same thing

Away from the plugin I've used Compass searchable-constants for this, and that has the additional benefit that you can can choose some other string, even an obfuscated one if you like.

The plugin supports searchable-constants internally but does not expose an API yet but it could be as simple as:

class City {
    static searchable = {
        constant "location"
        // other contstants and config
    }
    // ...
}

so that would work across the whole index like searchableService.search("+location +paris").

Cities are a nice example actually. Consider a large database of cities and then a search for "new york city": with exclude-alias-from-all turned off it returns many irrelevant results.

I've tended to avoid having the alias as part of the searchable data so as to try to make search results as relevant as possible.

I guess we both have our own differing opinions about this But I'm happy to let the users decide - shall we take it to the mailing list?

Exposing the constant config option should be trivial.


Shay Banon - 03/Mar/08 07:09 AM
Agreed, I prefer the constant solution as well as it provides more fine grained control. But, the question is out of the box experience, and it seems to me that having the alias as part of all out of the box is better.

Lets take it to the mailing list, and I will post a blog post asking as well. If people are for excluding the alias by default, I can add it as a Compass default as well.


Maurice Nicholson - 03/Mar/08 07:14 AM
Ok, I'll send an email tonight and you make a post... let's see what happens

And I couldn't resist implementing the "constants" feature already: http://jira.codehaus.org/browse/GRAILSPLUGINS-260


Shay Banon - 03/Mar/08 02:49 PM
Great feature!. I will post something now. Just looking at the docs, is there an option to configure index, store, and all the different aspects you can with constant?

Maurice Nicholson - 05/Mar/08 12:11 AM
Hmm, ok let's discuss this over at http://jira.codehaus.org/browse/GRAILSPLUGINS-260

Maurice Nicholson - 20/Mar/08 04:35 AM
once it's possible to define the sub-index in the searchable closure, this issue should be closed

Maurice Nicholson - 02/Apr/08 04:36 PM
Resolved in 0.5 branch thanks to Compass 2.0 upgrade

You can install the 0.5-SNAPSHOT from http://svn.codehaus.org/grails-plugins/grails-searchable/branches/0_5/grails-searchable-0.5-SNAPSHOT.zip

but note that it is Java 5 only until I wrap up the 0.4.1 release

The documentation for defining the sub-index in the searchable closure is here http://grails.org/Searchable+Plugin+-+Mapping#SearchablePlugin-Mapping-MappingDSL