Searchable Plugin

[Searchable Plugin] Oracle name

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.3
  • Fix Version/s: 0.5
  • Component/s: None
  • Labels:
    None

Description

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 .

Issue Links

Activity

Hide
Maurice Nicholson added a comment -

So you have configured a JDBC store for Compass?

Show
Maurice Nicholson added a comment - So you have configured a JDBC store for Compass?
Hide
Jonathan Lebrun added a comment -

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>

Show
Jonathan Lebrun added a comment - 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>
Hide
Maurice Nicholson added a comment -

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?

Show
Maurice Nicholson added a comment - 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?
Hide
Shay Banon added a comment -

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.

Show
Shay Banon added a comment - 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.
Hide
Maurice Nicholson added a comment -

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.

Show
Maurice Nicholson added a comment - 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.
Hide
Shay Banon added a comment -

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.

Show
Shay Banon added a comment - 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.
Hide
Maurice Nicholson added a comment -

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.

Show
Maurice Nicholson added a comment - 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.
Hide
Shay Banon added a comment -

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.

Show
Shay Banon added a comment - 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.
Hide
Maurice Nicholson added a comment -

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

Show
Maurice Nicholson added a comment - 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
Hide
Shay Banon added a comment -

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?

Show
Shay Banon added a comment - 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?
Hide
Maurice Nicholson added a comment -

Hmm, ok let's discuss this over at http://jira.codehaus.org/browse/GRAILSPLUGINS-260

Show
Maurice Nicholson added a comment - Hmm, ok let's discuss this over at http://jira.codehaus.org/browse/GRAILSPLUGINS-260
Hide
Maurice Nicholson added a comment -

once it's possible to define the sub-index in the searchable closure, this issue should be closed

Show
Maurice Nicholson added a comment - once it's possible to define the sub-index in the searchable closure, this issue should be closed
Hide
Maurice Nicholson added a comment -

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

Show
Maurice Nicholson added a comment - 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
Hide
Jonathan Lebrun added a comment -

Great !

Show
Jonathan Lebrun added a comment - Great !

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: