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 "Videnova, Svetlana" <sv...@logica.com> on 2012/08/10 11:28:04 UTC

multi-searching problem

Currently I'm using this in order to search:
###
<uniqueKey>article_id</uniqueKey>
<defaultSearchField>article_nom</defaultSearchField>
###

But I wish be able to add more parameters in my defaultSearchField.
I saw in some forums that is not possible with defaultSearchField to do multi requests and add parameters, but I can use dismax request.

I couldn't find none tutorials who explain properly how to use dismix :s
Can somebody please explain here, or maybe give to me better solution of my multisearching base problem?


Thank you for your time!


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.


Re: multi-searching problem

Posted by Erick Erickson <er...@gmail.com>.
You have two problems.
1> the & may or may not be interpreted as a character
of significance in the XML, you'd probably need make
it an entity as &amp;

2> this information should NOT be in your
schema.xml anyway. defType is a request handler
parameter, and should be in a request handler in
solrconfig.xml. Where you will see that there
aren't any & characters, you'd add this to the defaults
in your request handler like
<str name="defType">edismax</str>
<str name="qf">article_id article_nom</str>

not an '&' character in sight <G>...

Best
Erick

On Mon, Aug 13, 2012 at 12:42 AM, Videnova, Svetlana
<sv...@logica.com> wrote:
> I added this in schema.xml
>
> <schema>
> <fields>
> ...
> <dynamicField name="attr_*"     type="text" indexed="true" stored="true" multiValued="true"/>
>    &defType = edismax &qf = article_id article_nom
>  </fields>
>
> <uniqueKey>article_id</uniqueKey>
>
> <solrQueryParser defaultOperator="OR"/>
>
> </schema>
>
>
> But i have this error:
>
> ###
> org.xml.sax.SAXParseException: The reference to entity "defType" must end with the ';' delimiter. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source) at
> ###
>
> Is this a syntax problem? Am I writing defType wrong?
>
>
> Thank you
>
> -----Message d'origine-----
> De : Ahmet Arslan [mailto:iorixxx@yahoo.com]
> Envoyé : vendredi 10 août 2012 16:22
> À : solr-user@lucene.apache.org
> Objet : RE: multi-searching problem
>
>> It seems more complicate than i
>> need.
>> I just want, if the user specify nothing, to search in all my fields
>> that I declared in my schema.xml like that :
>> <defaultSearchField>article_nom</defaultSearchField>
>> but not only article_nom but all fields.
>> There should be some simple way to do that without using all of
>> this..?
>> Or am I wrong?
>
> It is not that complicated. Just list your fields in qf parameter, that's all. defType=edismax&qf=field1 field2 field3 ...
>
>
> Think green - keep it on the screen.
>
> This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
>
>

RE: multi-searching problem

Posted by "Videnova, Svetlana" <sv...@logica.com>.
Ok, thank you ill check that.

Have a nice day

-----Message d'origine-----
De : Ahmet Arslan [mailto:iorixxx@yahoo.com] 
Envoyé : lundi 13 août 2012 17:40
À : solr-user@lucene.apache.org
Objet : RE: multi-searching problem



--- On Mon, 8/13/12, Videnova, Svetlana <sv...@logica.com> wrote:

> From: Videnova, Svetlana <sv...@logica.com>
> Subject: RE: multi-searching problem
>  Thank you for your answer, finally it was only my bad between 
> copyfield and copyField. Now all good.
> I don't know how copyField and edismax working exactly, but can I do 
> both?
> Currently I copyed all fields in "all"
> <defaultSearchField>all</defaultSearchField>.
> So can I use edismax as well in the solrconfig.xml side?

(e)dismax is designed to search over multiple fields with different boosts. (article_id, article_norm, title etc)

Some advantages of (e)dismax over catch all field.
1) You can give different boosts to fields. qf=article_id^5 article_norm^3
2) If you want to add another search field you have to change your schema and re-index. With dismax no re-index is required.
3) With catch all field, you cannot use different fieldTypes. Think that you have two different field types for article_id and article_norm. (you may want different analysis for different fields) Once you copy them into all field, now you will be using fieldType of 'all' field. copyField copies raw content.
4-) Catch all field increases your index size.
5-) There is lots of useful parameters that you can fine-tune your relevancy. http://wiki.apache.org/solr/ExtendedDisMax


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



RE: multi-searching problem

Posted by Ahmet Arslan <io...@yahoo.com>.

--- On Mon, 8/13/12, Videnova, Svetlana <sv...@logica.com> wrote:

> From: Videnova, Svetlana <sv...@logica.com>
> Subject: RE: multi-searching problem
>  Thank you for your answer, finally it was only my bad
> between copyfield and copyField. Now all good.
> I don't know how copyField and edismax working exactly, but
> can I do both? 
> Currently I copyed all fields in "all"
> <defaultSearchField>all</defaultSearchField>.
> So can I use edismax as well in the solrconfig.xml side?

(e)dismax is designed to search over multiple fields with different boosts. (article_id, article_norm, title etc)

Some advantages of (e)dismax over catch all field.
1) You can give different boosts to fields. qf=article_id^5 article_norm^3
2) If you want to add another search field you have to change your schema and re-index. With dismax no re-index is required.
3) With catch all field, you cannot use different fieldTypes. Think that you have two different field types for article_id and article_norm. (you may want different analysis for different fields) Once you copy them into all field, now you will be using fieldType of 'all' field. copyField copies raw content.
4-) Catch all field increases your index size.
5-) There is lots of useful parameters that you can fine-tune your relevancy. http://wiki.apache.org/solr/ExtendedDisMax

RE: multi-searching problem

Posted by "Videnova, Svetlana" <sv...@logica.com>.
Hi Arslan,

 Thank you for your answer, finally it was only my bad between copyfield and copyField. Now all good.
I don't know how copyField and edismax working exactly, but can I do both? 
Currently I copyed all fields in "all" <defaultSearchField>all</defaultSearchField>.
So can I use edismax as well in the solrconfig.xml side?

Thank you!

-----Message d'origine-----
De : Ahmet Arslan [mailto:iorixxx@yahoo.com] 
Envoyé : lundi 13 août 2012 13:44
À : solr-user@lucene.apache.org
Objet : RE: multi-searching problem

> <field name="all" type="string" indexed="true" stored="true" 
> multiValued="true"/>
>     <copyfield source="article_id"
> dest="all"/>
>     <copyfield source="article_nom"
> dest="all"/>
>  </fields>
> 
> <uniqueKey>article_id</uniqueKey>
> <defaultSearchField>all</defaultSearchField>

It is always good idea to edit example schema.xml according to your needs.
See  copyField declarations. 

http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml

It is not copyfield  but copyField. Case-sensitive stuff. And copyField declarations are defined under the <uniqueKey>article_id</uniqueKey> definition in example schema.xml. 

By the way using edismax is more flexible than catch all field. 


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



RE: multi-searching problem

Posted by "Videnova, Svetlana" <sv...@logica.com>.
I follow this exemple https://github.com/boonious/misc/blob/master/fedora-solr-integration-conf/schema.xml but still no results 

-----Message d'origine-----
De : Videnova, Svetlana [mailto:svetlana.videnova@logica.com] 
Envoyé : lundi 13 août 2012 08:59
À : solr-user@lucene.apache.org
Objet : RE: multi-searching problem

I always tried this in my schema.xml: 

###
<field name="all" type="string" indexed="true"  stored="true" multiValued="true"/>
	<copyfield source="article_id" dest="all"/> 
	<copyfield source="article_nom" dest="all"/>  </fields>

<uniqueKey>article_id</uniqueKey>
<defaultSearchField>all</defaultSearchField>
###


I have no errors with that code but when I search for a term who is present in article_nom this give me 0 results ... I don't know why and where im doing wrong :s


Thank you for your help



-----Message d'origine-----
De : deniz [mailto:denizdurmus87@gmail.com] Envoyé : lundi 13 août 2012 08:54 À : solr-user@lucene.apache.org Objet : RE: multi-searching problem

well i dont know much stuff about dismax, but for making a search as default on multiple fields, you can use copyField which is simpler than dismax (though performance could be effected, I am not so sure) basically, you can copy the other fields into one field and make it your default search field and you are done... I have done a similar thing for providing a "universal search", where all of the fields on a document are checked by default



-----
Zeki ama calismiyor... Calissa yapar...
--
View this message in context: http://lucene.472066.n3.nabble.com/multi-searching-problem-tp4000433p4000748.html
Sent from the Solr - User mailing list archive at Nabble.com.


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.




Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



RE: multi-searching problem

Posted by Ahmet Arslan <io...@yahoo.com>.
> <field name="all" type="string" indexed="true" 
> stored="true" multiValued="true"/>
>     <copyfield source="article_id"
> dest="all"/> 
>     <copyfield source="article_nom"
> dest="all"/>
>  </fields>
> 
> <uniqueKey>article_id</uniqueKey>
> <defaultSearchField>all</defaultSearchField>

It is always good idea to edit example schema.xml according to your needs.
See  copyField declarations. 

http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/collection1/conf/schema.xml

It is not copyfield  but copyField. Case-sensitive stuff. And copyField declarations are defined under the <uniqueKey>article_id</uniqueKey> definition in example schema.xml. 

By the way using edismax is more flexible than catch all field. 

RE: multi-searching problem

Posted by "Videnova, Svetlana" <sv...@logica.com>.
I always tried this in my schema.xml: 

###
<field name="all" type="string" indexed="true"  stored="true" multiValued="true"/>
	<copyfield source="article_id" dest="all"/> 
	<copyfield source="article_nom" dest="all"/>
 </fields>

<uniqueKey>article_id</uniqueKey>
<defaultSearchField>all</defaultSearchField>
###


I have no errors with that code but when I search for a term who is present in article_nom this give me 0 results ... I don't know why and where im doing wrong :s


Thank you for your help



-----Message d'origine-----
De : deniz [mailto:denizdurmus87@gmail.com] 
Envoyé : lundi 13 août 2012 08:54
À : solr-user@lucene.apache.org
Objet : RE: multi-searching problem

well i dont know much stuff about dismax, but for making a search as default on multiple fields, you can use copyField which is simpler than dismax (though performance could be effected, I am not so sure) basically, you can copy the other fields into one field and make it your default search field and you are done... I have done a similar thing for providing a "universal search", where all of the fields on a document are checked by default



-----
Zeki ama calismiyor... Calissa yapar...
--
View this message in context: http://lucene.472066.n3.nabble.com/multi-searching-problem-tp4000433p4000748.html
Sent from the Solr - User mailing list archive at Nabble.com.


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



RE: multi-searching problem

Posted by deniz <de...@gmail.com>.
well i dont know much stuff about dismax, but for making a search as default
on multiple fields, you can use copyField which is simpler than dismax
(though performance could be effected, I am not so sure)
basically, you can copy the other fields into one field and make it your
default search field and you are done... I have done a similar thing for
providing a "universal search", where all of the fields on a document are
checked by default



-----
Zeki ama calismiyor... Calissa yapar...
--
View this message in context: http://lucene.472066.n3.nabble.com/multi-searching-problem-tp4000433p4000748.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: multi-searching problem

Posted by Ahmet Arslan <io...@yahoo.com>.
> <schema>
> <fields>
> ...
> <dynamicField name="attr_*"    
> type="text" indexed="true" stored="true"
> multiValued="true"/> 
>    &defType = edismax &qf =
> article_id article_nom   
>  </fields>
> 
> <uniqueKey>article_id</uniqueKey>
> 
> <solrQueryParser defaultOperator="OR"/>
>  
> </schema>
> 
> 
> But i have this error: 
> 
> ###
> org.xml.sax.SAXParseException: The reference to entity
> "defType" must end with the ';' delimiter. at

Hi Videnova,

&defType=edismax&qf=article_id article_nom&start=0&rows=10 is meant to append to you search URL. Alternatively you can set these parameters in "defaults" section.  
 
These default definition are belong to solrconfig.xml. (not schema.xml) Please see example solrconfig and search for 'edismax'

http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/collection1/conf/solrconfig.xml

You should have something like that : 

 <requestHandler name="/search" class="solr.SearchHandler">
     <lst name="defaults">
       <str name="echoParams">explicit</str>    

       <!-- Query settings -->
       <str name="defType">edismax</str>
       <str name="qf">article_id article_nom</str>
       <str name="df">text</str>
     </lst>

RE: multi-searching problem

Posted by "Videnova, Svetlana" <sv...@logica.com>.
I added this in schema.xml

<schema>
<fields>
...
<dynamicField name="attr_*" 	type="text" indexed="true" stored="true" multiValued="true"/> 
   &defType = edismax &qf = article_id article_nom   
 </fields>

<uniqueKey>article_id</uniqueKey>

<solrQueryParser defaultOperator="OR"/>
 
</schema>


But i have this error: 

###
org.xml.sax.SAXParseException: The reference to entity "defType" must end with the ';' delimiter. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source) at
###

Is this a syntax problem? Am I writing defType wrong?


Thank you

-----Message d'origine-----
De : Ahmet Arslan [mailto:iorixxx@yahoo.com] 
Envoyé : vendredi 10 août 2012 16:22
À : solr-user@lucene.apache.org
Objet : RE: multi-searching problem

> It seems more complicate than i
> need.
> I just want, if the user specify nothing, to search in all my fields 
> that I declared in my schema.xml like that :
> <defaultSearchField>article_nom</defaultSearchField>
> but not only article_nom but all fields.
> There should be some simple way to do that without using all of 
> this..?
> Or am I wrong? 

It is not that complicated. Just list your fields in qf parameter, that's all. defType=edismax&qf=field1 field2 field3 ... 


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



Re: multi-searching problem

Posted by Michael Della Bitta <mi...@appinions.com>.
Either you need to use dismax/edismax or have a catch-all text field
and copyField directives that copy the contents of your other fields
into it, and make that the default search field.

Michael Della Bitta

------------------------------------------------
Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
www.appinions.com
Where Influence Isn’t a Game


On Fri, Aug 10, 2012 at 8:44 AM, Videnova, Svetlana
<sv...@logica.com> wrote:
> It seems more complicate than i need.
> I just want, if the user specify nothing, to search in all my fields that I declared in my schema.xml
> like that : <defaultSearchField>article_nom</defaultSearchField> but not only article_nom but all fields.
> There should be some simple way to do that without using all of this..?
> Or am I wrong?
>
>
> -----Message d'origine-----
> De : Ahmet Arslan [mailto:iorixxx@yahoo.com]
> Envoyé : vendredi 10 août 2012 12:58
> À : solr-user@lucene.apache.org
> Objet : Re: multi-searching problem
>
>> I couldn't find none tutorials who explain properly how to use dismix
>> :s Can somebody please explain here, or maybe give to me better
>> solution of my multisearching base problem?
>
> http://searchhub.org/dev/2010/05/23/whats-a-dismax/
>
> Plus example solrconfig.xml has an example. Search for keyword 'dismax' in it.
>
>
> Think green - keep it on the screen.
>
> This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
>
>

RE: multi-searching problem

Posted by Ahmet Arslan <io...@yahoo.com>.
> It seems more complicate than i
> need.
> I just want, if the user specify nothing, to search in all
> my fields that I declared in my schema.xml 
> like that :
> <defaultSearchField>article_nom</defaultSearchField>
> but not only article_nom but all fields.
> There should be some simple way to do that without using all
> of this..?
> Or am I wrong? 

It is not that complicated. Just list your fields in qf parameter, that's all. defType=edismax&qf=field1 field2 field3 ... 

RE: multi-searching problem

Posted by "Videnova, Svetlana" <sv...@logica.com>.
It seems more complicate than i need.
I just want, if the user specify nothing, to search in all my fields that I declared in my schema.xml 
like that : <defaultSearchField>article_nom</defaultSearchField> but not only article_nom but all fields.
There should be some simple way to do that without using all of this..?
Or am I wrong? 


-----Message d'origine-----
De : Ahmet Arslan [mailto:iorixxx@yahoo.com] 
Envoyé : vendredi 10 août 2012 12:58
À : solr-user@lucene.apache.org
Objet : Re: multi-searching problem

> I couldn't find none tutorials who explain properly how to use dismix 
> :s Can somebody please explain here, or maybe give to me better 
> solution of my multisearching base problem?

http://searchhub.org/dev/2010/05/23/whats-a-dismax/

Plus example solrconfig.xml has an example. Search for keyword 'dismax' in it.


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



Re: multi-searching problem

Posted by Ahmet Arslan <io...@yahoo.com>.
> I couldn't find none tutorials who explain properly how to
> use dismix :s
> Can somebody please explain here, or maybe give to me better
> solution of my multisearching base problem?

http://searchhub.org/dev/2010/05/23/whats-a-dismax/

Plus example solrconfig.xml has an example. Search for keyword 'dismax' in it.