Bug with DIH and MySQL CONCAT()?

View: New views
10 Messages — Rating Filter:   Alert me  

Bug with DIH and MySQL CONCAT()?

by Jonathan Hendler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I have an SQL query that begins with "SELECT CONCAT (  'ID',  
Subject.id  , ':' , Subject.name , ':L', Subject.level) as  
subject_name" and the query runs great against MySQL from the command  
line.
Since this is a nested entity, the schema.xml contains "<field  
name="subject_name" type="string" indexed="true" stored="true"  
multiValued="true" />"

After a full-import, a select output of the xml looks like

"<arr name="subject_name">
<str>[B@1db4c43</str>
<str>[B@6bcef1</str>
<str>[B@1df503b</str>
<str>[B@c5dbb</str>
<str>[B@1ddc3ea</str>
<str>[B@6963b0</str>
<str>[B@10fe215</str>
...
"

Without a CONCAT - it works fine.

Is this a bug?

Meanwhile - should I go about concatenating some where else in the DIH  
config?

Thanks.

- Jonathan



Re: Bug with DIH and MySQL CONCAT()?

by Chantal Ackermann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jonathan,

the concatenation seems to return a byte array because those are
rendered into a string starting with "[B" when calling toString() on them.

I have no suggestion on how to get a different return value from that
sql query.

To concatenate you could also use a transformer. Simply return all
values separately and write a ScriptTransformer that concatenates them
and returns them as java.lang.String.

cheers,
Chantal

Jonathan Hendler schrieb:

> Hi All,
>
> I have an SQL query that begins with "SELECT CONCAT (  'ID',
> Subject.id  , ':' , Subject.name , ':L', Subject.level) as
> subject_name" and the query runs great against MySQL from the command
> line.
> Since this is a nested entity, the schema.xml contains "<field
> name="subject_name" type="string" indexed="true" stored="true"
> multiValued="true" />"
>
> After a full-import, a select output of the xml looks like
>
> "<arr name="subject_name">
> <str>[B@1db4c43</str>
> <str>[B@6bcef1</str>
> <str>[B@1df503b</str>
> <str>[B@c5dbb</str>
> <str>[B@1ddc3ea</str>
> <str>[B@6963b0</str>
> <str>[B@10fe215</str>
> ...
> "
>
> Without a CONCAT - it works fine.
>
> Is this a bug?
>
> Meanwhile - should I go about concatenating some where else in the DIH
> config?
>
> Thanks.
>
> - Jonathan
>
>

Re: Bug with DIH and MySQL CONCAT()?

by Avlesh Singh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try cast(concat(...) as char) ...

Cheers
Avlesh

On Wed, Nov 4, 2009 at 7:36 PM, Jonathan Hendler <jonathan.hendler@...
> wrote:

> Hi All,
>
> I have an SQL query that begins with "SELECT CONCAT (  'ID', Subject.id  ,
> ':' , Subject.name , ':L', Subject.level) as subject_name" and the query
> runs great against MySQL from the command line.
> Since this is a nested entity, the schema.xml contains "<field
> name="subject_name" type="string" indexed="true" stored="true"
> multiValued="true" />"
>
> After a full-import, a select output of the xml looks like
>
> "<arr name="subject_name">
> <str>[B@1db4c43</str>
> <str>[B@6bcef1</str>
> <str>[B@1df503b</str>
> <str>[B@c5dbb</str>
> <str>[B@1ddc3ea</str>
> <str>[B@6963b0</str>
> <str>[B@10fe215</str>
> ...
> "
>
> Without a CONCAT - it works fine.
>
> Is this a bug?
>
> Meanwhile - should I go about concatenating some where else in the DIH
> config?
>
> Thanks.
>
> - Jonathan
>
>
>

Re: Bug with DIH and MySQL CONCAT()?

by Jonathan Hendler-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Chantal for the explanation of the issue.
Avlesh - worked great. Thank you!


On Nov 4, 2009, at 9:44 AM, Avlesh Singh wrote:

> Try cast(concat(...) as char) ...
>
> Cheers
> Avlesh
>
> On Wed, Nov 4, 2009 at 7:36 PM, Jonathan Hendler <jonathan.hendler@...
>> wrote:
>
>> Hi All,
>>
>> I have an SQL query that begins with "SELECT CONCAT (  'ID',  
>> Subject.id  ,
>> ':' , Subject.name , ':L', Subject.level) as subject_name" and the  
>> query
>> runs great against MySQL from the command line.
>> Since this is a nested entity, the schema.xml contains "<field
>> name="subject_name" type="string" indexed="true" stored="true"
>> multiValued="true" />"
>>
>> After a full-import, a select output of the xml looks like
>>
>> "<arr name="subject_name">
>> <str>[B@1db4c43</str>
>> <str>[B@6bcef1</str>
>> <str>[B@1df503b</str>
>> <str>[B@c5dbb</str>
>> <str>[B@1ddc3ea</str>
>> <str>[B@6963b0</str>
>> <str>[B@10fe215</str>
>> ...
>> "
>>
>> Without a CONCAT - it works fine.
>>
>> Is this a bug?
>>
>> Meanwhile - should I go about concatenating some where else in the  
>> DIH
>> config?
>>
>> Thanks.
>>
>> - Jonathan
>>
>>
>>


dismax + wildcard

by Jan Kammer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

what is the best way to search all fields AND use wildcards?
Somewhere I read that there are problems with this combination...
(dismax + wildcard)


Thanks,


Jan





smime.p7s (8K) Download Attachment

RE: dismax + wildcard

by ANKITBHATNAGAR :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



 Hi Jan,
 You could write a dismax request handler and then then in the query you could specify like -

q=something&qt=dismaxhandler&fq=type:something

This might help.

Thanks
-Ankit





-----Original Message-----
From: Jan Kammer [mailto:jan.kammer@...]
Sent: Wednesday, November 04, 2009 10:38 AM
To: solr-user@...
Subject: dismax + wildcard

Hi there,

what is the best way to search all fields AND use wildcards?
Somewhere I read that there are problems with this combination...
(dismax + wildcard)


Thanks,


Jan




Re: Bug with DIH and MySQL CONCAT()?

by Noble Paul നോബിള്‍ नोब्ळ्-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks,
It would be nice to add this to the DIH FAQ

On Wed, Nov 4, 2009 at 8:27 PM, Jonathan Hendler
<jonathan.hendler@...> wrote:

> Thanks Chantal for the explanation of the issue.
> Avlesh - worked great. Thank you!
>
>
> On Nov 4, 2009, at 9:44 AM, Avlesh Singh wrote:
>
>> Try cast(concat(...) as char) ...
>>
>> Cheers
>> Avlesh
>>
>> On Wed, Nov 4, 2009 at 7:36 PM, Jonathan Hendler
>> <jonathan.hendler@...
>>>
>>> wrote:
>>
>>> Hi All,
>>>
>>> I have an SQL query that begins with "SELECT CONCAT (  'ID', Subject.id
>>>  ,
>>> ':' , Subject.name , ':L', Subject.level) as subject_name" and the query
>>> runs great against MySQL from the command line.
>>> Since this is a nested entity, the schema.xml contains "<field
>>> name="subject_name" type="string" indexed="true" stored="true"
>>> multiValued="true" />"
>>>
>>> After a full-import, a select output of the xml looks like
>>>
>>> "<arr name="subject_name">
>>> <str>[B@1db4c43</str>
>>> <str>[B@6bcef1</str>
>>> <str>[B@1df503b</str>
>>> <str>[B@c5dbb</str>
>>> <str>[B@1ddc3ea</str>
>>> <str>[B@6963b0</str>
>>> <str>[B@10fe215</str>
>>> ...
>>> "
>>>
>>> Without a CONCAT - it works fine.
>>>
>>> Is this a bug?
>>>
>>> Meanwhile - should I go about concatenating some where else in the DIH
>>> config?
>>>
>>> Thanks.
>>>
>>> - Jonathan
>>>
>>>
>>>
>
>



--
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: dismax + wildcard

by Koji Sekiguchi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jan Kammer wrote:
> Hi there,
>
> what is the best way to search all fields AND use wildcards?
> Somewhere I read that there are problems with this combination...
> (dismax + wildcard)
>
It's a feature of dismax. WildcardQuery cannot be used in dismax q
parameter.

You can copy the "all fields" to a destination field by using
copyField, then search the destination field with wildcards
(without using dismax).

Koji

--
http://www.rondhuit.com/en/


Re: dismax + wildcard

by hossman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


: Subject: dismax + wildcard
: References: <3C9E9890-E1E9-43B0-BD01-B9FA4A77FF30@...>
:     <f19741740911040644p7303c611k99759fe19ebd9089@...>
:     <C864B97D-3368-4244-94A1-5BD2ED74E3D5@...>
: In-Reply-To: <C864B97D-3368-4244-94A1-5BD2ED74E3D5@...>

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to
an existing message, instead start a fresh email.  Even if you change the
subject line of your email, other mail headers still track which thread
you replied to and your question is "hidden" in that thread and gets less
attention.   It makes following discussions in the mailing list archives
particularly difficult.
See Also:  http://en.wikipedia.org/wiki/Thread_hijacking




-Hoss


Re: dismax + wildcard

by Peter Wolanin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are some open issues (not for 1.4 at this point) to make dismax
more flexible or add wildcard handling, e.g:

https://issues.apache.org/jira/browse/SOLR-756
https://issues.apache.org/jira/browse/SOLR-758

You might participate in those to try to get this in a future version
and/or get a working patch for 1.4

-Peter

On Wed, Nov 4, 2009 at 7:04 PM, Koji Sekiguchi <koji@...> wrote:

> Jan Kammer wrote:
>>
>> Hi there,
>>
>> what is the best way to search all fields AND use wildcards?
>> Somewhere I read that there are problems with this combination... (dismax
>> + wildcard)
>>
> It's a feature of dismax. WildcardQuery cannot be used in dismax q
> parameter.
>
> You can copy the "all fields" to a destination field by using
> copyField, then search the destination field with wildcards
> (without using dismax).
>
> Koji
>
> --
> http://www.rondhuit.com/en/
>
>



--
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
peter.wolanin@...