You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by occurred <sc...@infodienst-ausschreibungen.de> on 2011/06/04 09:44:52 UTC

Search with Synonyms in two fields

Hello,

a query will be like this:

field1:(DE123)

my synonyms are:
DE123 => 123,456,789

then SOLR should search in field1 for DE123 and in another specified field
for the synonyms so for example:
in field2 for 123 OR 456 OR 789

is this somehow possible?

cheers
Charlie 

--
View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Search with Synonyms in two fields

Posted by occurred <sc...@infodienst-ausschreibungen.de>.
Yeah, this is also a way to go.
Was thinking about it, but isn't a very beautiful solution.

cheers
Charlie

Am 05.06.11 00:51, schrieb lee carroll [via Lucene]:
> your app can do the above search?
>
> On 4 June 2011 20:42, occurred <[hidden email] 
> </user/SendEmail.jtp?type=node&node=3024794&i=0>> wrote:
>
> > No, there should be only one field search:
> > field1:DE123
> >
> > and then based on the config of a FilterFactory Solr will also 
> search in
> > field2 based on a synonym list.
> > But also field1 should be search with DE123
> >
> > cheers
> > Charlie
> >
> > Am 04.06.11 17:34, schrieb lee carroll [via Lucene]:
> >> I'm not sure if this is what you mean:
> >> copy field1 to field2 and for field 2 apply your analysis chain with
> >> your synonym list
> >>
> >> query something like field1:DE123 and field2:DE123
> >>
> >> or have i missed the point, if so can you clarify your use case
> >>
> >> cheers lee c
> >>
> >> On 4 June 2011 08:44, occurred <[hidden email]
> >> </user/SendEmail.jtp?type=node&node=3023443&i=0>> wrote:
> >>
> >> > Hello,
> >> >
> >> > a query will be like this:
> >> >
> >> > field1:(DE123)
> >> >
> >> > my synonyms are:
> >> > DE123 => 123,456,789
> >> >
> >> > then SOLR should search in field1 for DE123 and in another specified
> >> field
> >> > for the synonyms so for example:
> >> > in field2 for 123 OR 456 OR 789
> >> >
> >> > is this somehow possible?
> >> >
> >> > cheers
> >> > Charlie
> >> >
> >> > --
> >> > View this message in context:
> >> 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
> >> > Sent from the Solr - User mailing list archive at Nabble.com.
> >> >
> >>
> >>
> >> 
> ------------------------------------------------------------------------
> >> If you reply to this email, your message will be added to the
> >> discussion below:
> >> 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3023443.html
> >>
> >> To unsubscribe from Search with Synonyms in two fields, click here
> >> <
> >>
> >
> >
> > --
> > View this message in context: 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024166.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024794.html 
>
> To unsubscribe from Search with Synonyms in two fields, click here 
> <http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3022534&code=c2NoYXVibWFpckBpbmZvZGllbnN0LWF1c3NjaHJlaWJ1bmdlbi5kZXwzMDIyNTM0fDUxNjgwOTg4>. 
>


--
View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3025525.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Search with Synonyms in two fields

Posted by lee carroll <le...@googlemail.com>.
your app can do the above search?

On 4 June 2011 20:42, occurred <sc...@infodienst-ausschreibungen.de> wrote:
> No, there should be only one field search:
> field1:DE123
>
> and then based on the config of a FilterFactory Solr will also search in
> field2 based on a synonym list.
> But also field1 should be search with DE123
>
> cheers
> Charlie
>
> Am 04.06.11 17:34, schrieb lee carroll [via Lucene]:
>> I'm not sure if this is what you mean:
>> copy field1 to field2 and for field 2 apply your analysis chain with
>> your synonym list
>>
>> query something like field1:DE123 and field2:DE123
>>
>> or have i missed the point, if so can you clarify your use case
>>
>> cheers lee c
>>
>> On 4 June 2011 08:44, occurred <[hidden email]
>> </user/SendEmail.jtp?type=node&node=3023443&i=0>> wrote:
>>
>> > Hello,
>> >
>> > a query will be like this:
>> >
>> > field1:(DE123)
>> >
>> > my synonyms are:
>> > DE123 => 123,456,789
>> >
>> > then SOLR should search in field1 for DE123 and in another specified
>> field
>> > for the synonyms so for example:
>> > in field2 for 123 OR 456 OR 789
>> >
>> > is this somehow possible?
>> >
>> > cheers
>> > Charlie
>> >
>> > --
>> > View this message in context:
>> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
>> > Sent from the Solr - User mailing list archive at Nabble.com.
>> >
>>
>>
>> ------------------------------------------------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3023443.html
>>
>> To unsubscribe from Search with Synonyms in two fields, click here
>> <http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3022534&code=c2NoYXVibWFpckBpbmZvZGllbnN0LWF1c3NjaHJlaWJ1bmdlbi5kZXwzMDIyNTM0fDUxNjgwOTg4>.
>>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024166.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Search with Synonyms in two fields

Posted by Jonathan Rochkind <ro...@jhu.edu>.
On 6/5/2011 3:36 AM, occurred wrote:
> Ok, thx for the answer.
>
> My idea now is to store both field-values in one field and pre- and
> suffix the values from field2 with something very special.
> Also then the synonyms have to have the special pre- and suffixes.

What are you actually trying to do?

Usually, what people would do is just store both original values and 
synonym expansion in one field, the end, no need to use custom suffixes. 
Then you could have a _second_ field with only the original values 
without synonym expansion, if you sometimes need to search without 
synonym expansion.

You want to search over both original values and expanded synonyms, you 
search over the field that does that. You want to, in another search, 
search only over original values without synonym expansion, you search 
over the field without synonyms expanded in it.

That's usually the sort of thing people do. "de-normalization" in Solr 
is not something to be avoided, it's instead a general pattern.


Re: Search with Synonyms in two fields

Posted by occurred <sc...@infodienst-ausschreibungen.de>.
Ok, thx for the answer.

My idea now is to store both field-values in one field and pre- and 
suffix the values from field2 with something very special.
Also then the synonyms have to have the special pre- and suffixes.

cheers
Charlie

Am 05.06.11 01:33, schrieb Jonathan Rochkind [via Lucene]:
> There's no way to have Solr search a second field when a first field 
> is specified based on the config of a FilterFactory.
>
> You can set things up so you don't need to search two fields, only 
> one. Or you can explicitly specify two fields to search. Or you can 
> even use dismax query parser 'qf' to have a certain query search over 
> two fields and combine the results with dismax.
>
> But there's no way to tell Solr that when you specify "field1" in a 
> lucene query parser query, it should also search field2 in addition to 
> field1 even though you didn't ask for it.
>
> This is separate from synonyms, with or without synonyms.
>
> Depending on what you're really trying to accomplish, there may be a 
> simple answer.
> ________________________________________
> From: occurred [[hidden email] 
> </user/SendEmail.jtp?type=node&node=3024988&i=0>]
> Sent: Saturday, June 04, 2011 3:42 PM
> To: [hidden email] </user/SendEmail.jtp?type=node&node=3024988&i=1>
> Subject: Re: Search with Synonyms in two fields
>
> No, there should be only one field search:
> field1:DE123
>
> and then based on the config of a FilterFactory Solr will also search in
> field2 based on a synonym list.
> But also field1 should be search with DE123
>
> cheers
> Charlie
>
> Am 04.06.11 17:34, schrieb lee carroll [via Lucene]:
>
> > I'm not sure if this is what you mean:
> > copy field1 to field2 and for field 2 apply your analysis chain with
> > your synonym list
> >
> > query something like field1:DE123 and field2:DE123
> >
> > or have i missed the point, if so can you clarify your use case
> >
> > cheers lee c
> >
> > On 4 June 2011 08:44, occurred <[hidden email]
> > </user/SendEmail.jtp?type=node&node=3023443&i=0>> wrote:
> >
> > > Hello,
> > >
> > > a query will be like this:
> > >
> > > field1:(DE123)
> > >
> > > my synonyms are:
> > > DE123 => 123,456,789
> > >
> > > then SOLR should search in field1 for DE123 and in another specified
> > field
> > > for the synonyms so for example:
> > > in field2 for 123 OR 456 OR 789
> > >
> > > is this somehow possible?
> > >
> > > cheers
> > > Charlie
> > >
> > > --
> > > View this message in context:
> > 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
> > > Sent from the Solr - User mailing list archive at Nabble.com.
> > >
> >
> >
> > 
> ------------------------------------------------------------------------
> > If you reply to this email, your message will be added to the
> > discussion below:
> > 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3023443.html
> >
> > To unsubscribe from Search with Synonyms in two fields, click here
> > <
> >
>
>
> -- 
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024166.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024988.html 
>
> To unsubscribe from Search with Synonyms in two fields, click here 
> <http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3022534&code=c2NoYXVibWFpckBpbmZvZGllbnN0LWF1c3NjaHJlaWJ1bmdlbi5kZXwzMDIyNTM0fDUxNjgwOTg4>. 
>


--
View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3025528.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Search with Synonyms in two fields

Posted by Jonathan Rochkind <ro...@jhu.edu>.
There's no way to have Solr search a second field when a first field is specified based on the config of a FilterFactory. 

You can set things up so you don't need to search two fields, only one. Or you can explicitly specify two fields to search. Or you can even use dismax query parser 'qf' to have a certain query search over two fields and combine the results with dismax.  

But there's no way to tell Solr that when you specify "field1" in a lucene query parser query, it should also search field2 in addition to field1 even though you didn't ask for it. 

This is separate from synonyms, with or without synonyms. 

Depending on what you're really trying to accomplish, there may be a simple answer. 
________________________________________
From: occurred [schaubmair@infodienst-ausschreibungen.de]
Sent: Saturday, June 04, 2011 3:42 PM
To: solr-user@lucene.apache.org
Subject: Re: Search with Synonyms in two fields

No, there should be only one field search:
field1:DE123

and then based on the config of a FilterFactory Solr will also search in
field2 based on a synonym list.
But also field1 should be search with DE123

cheers
Charlie

Am 04.06.11 17:34, schrieb lee carroll [via Lucene]:
> I'm not sure if this is what you mean:
> copy field1 to field2 and for field 2 apply your analysis chain with
> your synonym list
>
> query something like field1:DE123 and field2:DE123
>
> or have i missed the point, if so can you clarify your use case
>
> cheers lee c
>
> On 4 June 2011 08:44, occurred <[hidden email]
> </user/SendEmail.jtp?type=node&node=3023443&i=0>> wrote:
>
> > Hello,
> >
> > a query will be like this:
> >
> > field1:(DE123)
> >
> > my synonyms are:
> > DE123 => 123,456,789
> >
> > then SOLR should search in field1 for DE123 and in another specified
> field
> > for the synonyms so for example:
> > in field2 for 123 OR 456 OR 789
> >
> > is this somehow possible?
> >
> > cheers
> > Charlie
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3023443.html
>
> To unsubscribe from Search with Synonyms in two fields, click here
> <http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3022534&code=c2NoYXVibWFpckBpbmZvZGllbnN0LWF1c3NjaHJlaWJ1bmdlbi5kZXwzMDIyNTM0fDUxNjgwOTg4>.
>


--
View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024166.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Search with Synonyms in two fields

Posted by occurred <sc...@infodienst-ausschreibungen.de>.
No, there should be only one field search:
field1:DE123

and then based on the config of a FilterFactory Solr will also search in 
field2 based on a synonym list.
But also field1 should be search with DE123

cheers
Charlie

Am 04.06.11 17:34, schrieb lee carroll [via Lucene]:
> I'm not sure if this is what you mean:
> copy field1 to field2 and for field 2 apply your analysis chain with
> your synonym list
>
> query something like field1:DE123 and field2:DE123
>
> or have i missed the point, if so can you clarify your use case
>
> cheers lee c
>
> On 4 June 2011 08:44, occurred <[hidden email] 
> </user/SendEmail.jtp?type=node&node=3023443&i=0>> wrote:
>
> > Hello,
> >
> > a query will be like this:
> >
> > field1:(DE123)
> >
> > my synonyms are:
> > DE123 => 123,456,789
> >
> > then SOLR should search in field1 for DE123 and in another specified 
> field
> > for the synonyms so for example:
> > in field2 for 123 OR 456 OR 789
> >
> > is this somehow possible?
> >
> > cheers
> > Charlie
> >
> > --
> > View this message in context: 
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3023443.html 
>
> To unsubscribe from Search with Synonyms in two fields, click here 
> <http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3022534&code=c2NoYXVibWFpckBpbmZvZGllbnN0LWF1c3NjaHJlaWJ1bmdlbi5kZXwzMDIyNTM0fDUxNjgwOTg4>. 
>


--
View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3024166.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Search with Synonyms in two fields

Posted by lee carroll <le...@googlemail.com>.
I'm not sure if this is what you mean:
copy field1 to field2 and for field 2 apply your analysis chain with
your synonym list

query something like field1:DE123 and field2:DE123

or have i missed the point, if so can you clarify your use case

cheers lee c

On 4 June 2011 08:44, occurred <sc...@infodienst-ausschreibungen.de> wrote:
> Hello,
>
> a query will be like this:
>
> field1:(DE123)
>
> my synonyms are:
> DE123 => 123,456,789
>
> then SOLR should search in field1 for DE123 and in another specified field
> for the synonyms so for example:
> in field2 for 123 OR 456 OR 789
>
> is this somehow possible?
>
> cheers
> Charlie
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Search-with-Synonyms-in-two-fields-tp3022534p3022534.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>