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 "Croci Francesco Luigi (ID SWS)" <fc...@id.ethz.ch> on 2014/04/04 10:52:34 UTC

Query and field name with wildcard

In my index I have some fields which have the same prefix(rmDocumentTitle, rmDocumentClass, rmDocumentSubclass, rmDocumentArt). Apparently it is not possible to specify a query like this:

q = rm* : some_word

Is there a way to do this without having to write a long list of ORs?

Another question is if it is really not possible to search a word over the entire index. Something like this: q = * : some_word

Thank you
Francesco

Re: Query and field name with wildcard

Posted by Jack Krupansky <ja...@basetechnology.com>.
The LucidWorks Search query parser lets you use the "all" pseudo-field to 
search across all fields.

See:
http://docs.lucidworks.com/display/lweug/Field+Queries

For example:

q = all:some_word

-- Jack Krupansky

-----Original Message----- 
From: Ahmet Arslan
Sent: Friday, April 4, 2014 8:13 AM
To: solr-user@lucene.apache.org
Subject: Re: Query and field name with wildcard

Hi,

bq. possible to search a word over the entire index.

You can a get list of all searchable fields (indexed=true) programmatically 
by https://wiki.apache.org/solr/LukeRequestHandler
And then you can fed this list to qf parameter of (e)dismax.

This could be implemented as a custom query parser plugin that searches a 
word over the entire index.


Ahmet


On Friday, April 4, 2014 12:08 PM, Alexandre Rafalovitch 
<ar...@gmail.com> wrote:
Are you using eDisMax. That gives a lot of options, including field
aliasing, including a single name to multiple fields:
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
(with example on p77 of my book
http://www.packtpub.com/apache-solr-for-indexing-data/book :-)

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/
Current project: http://www.solr-start.com/ - Accelerating your Solr 
proficiency



On Fri, Apr 4, 2014 at 3:52 PM, Croci  Francesco Luigi (ID SWS)
<fc...@id.ethz.ch> wrote:
> In my index I have some fields which have the same prefix(rmDocumentTitle, 
> rmDocumentClass, rmDocumentSubclass, rmDocumentArt). Apparently it is not 
> possible to specify a query like this:
>
> q = rm* : some_word
>
> Is there a way to do this without having to write a long list of ORs?
>
> Another question is if it is really not possible to search a word over the 
> entire index. Something like this: q = * : some_word
>
> Thank you
> Francesco 


Re: Query and field name with wildcard

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

bq. possible to search a word over the entire index.

You can a get list of all searchable fields (indexed=true) programmatically by https://wiki.apache.org/solr/LukeRequestHandler
And then you can fed this list to qf parameter of (e)dismax.

This could be implemented as a custom query parser plugin that searches a word over the entire index.


Ahmet


On Friday, April 4, 2014 12:08 PM, Alexandre Rafalovitch <ar...@gmail.com> wrote:
Are you using eDisMax. That gives a lot of options, including field
aliasing, including a single name to multiple fields:
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
(with example on p77 of my book
http://www.packtpub.com/apache-solr-for-indexing-data/book :-)

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/
Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency



On Fri, Apr 4, 2014 at 3:52 PM, Croci  Francesco Luigi (ID SWS)
<fc...@id.ethz.ch> wrote:
> In my index I have some fields which have the same prefix(rmDocumentTitle, rmDocumentClass, rmDocumentSubclass, rmDocumentArt). Apparently it is not possible to specify a query like this:
>
> q = rm* : some_word
>
> Is there a way to do this without having to write a long list of ORs?
>
> Another question is if it is really not possible to search a word over the entire index. Something like this: q = * : some_word
>
> Thank you
> Francesco


RE: Query and field name with wildcard

Posted by "Croci Francesco Luigi (ID SWS)" <fc...@id.ethz.ch>.
Sorry, found the problem myself...

I used the /select where the <str name="defType">edismax</str> was not defined. The other two, /selectEN and  /selectDE, worked.

Adding the edismax to the /select made it work too.

Ciao
Francesco

-----Original Message-----
From: Croci Francesco Luigi (ID SWS) [mailto:fcroci@id.ethz.ch] 
Sent: Montag, 7. April 2014 11:20
To: solr-user@lucene.apache.org
Subject: RE: Query and field name with wildcard

Hello Alex,

I saw your example and took it as template for my needs.

I tried with the aliasing, but, maybe because I did it wrong, it does not work...

"error": {
    "msg": "undefined field all",
    "code": 400
  }

Here is a snippet of my solrconfig.xml:

...
<requestHandler name="/select" class="solr.SearchHandler">
		<lst name="defaults">
			<str name="echoParams">explicit</str>
		</lst>
		<lst name="invariants">
			<str name="f.all.qf">rmDocumentTitle rmDocumentArt rmDocumentClass rmDocumentSubclass rmDocumentCatName rmDocumentCatNameEn fullText</str>
		</lst>
	</requestHandler>
	
	<requestHandler name="/selectEN" class="solr.SearchHandler" >
	  <lst name="defaults">
			<str name="defType">edismax</str>
			<str name="qf">fullText_en</str>
			<str name="df">full_Text</str>
			<str name="wt">json</str>
			<str name="indent">true</str>
	  </lst>
	  <lst name="invariants">
			<str name="fq">language:en</str>
			<str name="f.fullText.qf">fullText_en</str>
			<str name="f.all.qf">rmDocumentTitle rmDocumentArt rmDocumentClass rmDocumentSubclass rmDocumentCatName rmDocumentCatNameEn fullText_en</str>
			<str name="uf">* -fullText_*</str>
			<str name="fl">*,fullText:fullText_en</str>
	  </lst>
	</requestHandler>
	
	<requestHandler name="/selectDE" class="solr.SearchHandler" >
	  <lst name="defaults">
			<str name="defType">edismax</str>
			<str name="qf">fullText_de</str>
			<str name="df">full_Text</str>
			<str name="wt">json</str>
			<str name="indent">true</str>
	  </lst>
	  <lst name="invariants">
			<str name="fq">language:de</str>
			<str name="f.fullText.qf">fullText_de</str>
			<str name="f.all.qf">rmDocumentTitle rmDocumentArt rmDocumentClass rmDocumentSubclass rmDocumentCatName rmDocumentCatNameEn fullText_de</str>
			<str name="uf">* -fullText_*</str>
			<str name="fl">*,fullText:fullText_de</str>
	  </lst>
	</requestHandler>
...

What am I missing/ doing wrong?


Regards,
Francesco

-----Original Message-----
From: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
Sent: Freitag, 4. April 2014 11:08
To: solr-user@lucene.apache.org
Subject: Re: Query and field name with wildcard

Are you using eDisMax. That gives a lot of options, including field aliasing, including a single name to multiple fields:
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
(with example on p77 of my book
http://www.packtpub.com/apache-solr-for-indexing-data/book :-)

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/ Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency


On Fri, Apr 4, 2014 at 3:52 PM, Croci  Francesco Luigi (ID SWS) <fc...@id.ethz.ch> wrote:
> In my index I have some fields which have the same prefix(rmDocumentTitle, rmDocumentClass, rmDocumentSubclass, rmDocumentArt). Apparently it is not possible to specify a query like this:
>
> q = rm* : some_word
>
> Is there a way to do this without having to write a long list of ORs?
>
> Another question is if it is really not possible to search a word over 
> the entire index. Something like this: q = * : some_word
>
> Thank you
> Francesco

RE: Query and field name with wildcard

Posted by "Croci Francesco Luigi (ID SWS)" <fc...@id.ethz.ch>.
Hello Alex,

I saw your example and took it as template for my needs.

I tried with the aliasing, but, maybe because I did it wrong, it does not work...

"error": {
    "msg": "undefined field all",
    "code": 400
  }

Here is a snippet of my solrconfig.xml:

...
<requestHandler name="/select" class="solr.SearchHandler">
		<lst name="defaults">
			<str name="echoParams">explicit</str>
		</lst>
		<lst name="invariants">
			<str name="f.all.qf">rmDocumentTitle rmDocumentArt rmDocumentClass rmDocumentSubclass rmDocumentCatName rmDocumentCatNameEn fullText</str>
		</lst>
	</requestHandler>
	
	<requestHandler name="/selectEN" class="solr.SearchHandler" >
	  <lst name="defaults">
			<str name="defType">edismax</str>
			<str name="qf">fullText_en</str>
			<str name="df">full_Text</str>
			<str name="wt">json</str>
			<str name="indent">true</str>
	  </lst>
	  <lst name="invariants">
			<str name="fq">language:en</str>
			<str name="f.fullText.qf">fullText_en</str>
			<str name="f.all.qf">rmDocumentTitle rmDocumentArt rmDocumentClass rmDocumentSubclass rmDocumentCatName rmDocumentCatNameEn fullText_en</str>
			<str name="uf">* -fullText_*</str>
			<str name="fl">*,fullText:fullText_en</str>
	  </lst>
	</requestHandler>
	
	<requestHandler name="/selectDE" class="solr.SearchHandler" >
	  <lst name="defaults">
			<str name="defType">edismax</str>
			<str name="qf">fullText_de</str>
			<str name="df">full_Text</str>
			<str name="wt">json</str>
			<str name="indent">true</str>
	  </lst>
	  <lst name="invariants">
			<str name="fq">language:de</str>
			<str name="f.fullText.qf">fullText_de</str>
			<str name="f.all.qf">rmDocumentTitle rmDocumentArt rmDocumentClass rmDocumentSubclass rmDocumentCatName rmDocumentCatNameEn fullText_de</str>
			<str name="uf">* -fullText_*</str>
			<str name="fl">*,fullText:fullText_de</str>
	  </lst>
	</requestHandler>
...

What am I missing/ doing wrong?


Regards,
Francesco

-----Original Message-----
From: Alexandre Rafalovitch [mailto:arafalov@gmail.com] 
Sent: Freitag, 4. April 2014 11:08
To: solr-user@lucene.apache.org
Subject: Re: Query and field name with wildcard

Are you using eDisMax. That gives a lot of options, including field aliasing, including a single name to multiple fields:
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
(with example on p77 of my book
http://www.packtpub.com/apache-solr-for-indexing-data/book :-)

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/ Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency


On Fri, Apr 4, 2014 at 3:52 PM, Croci  Francesco Luigi (ID SWS) <fc...@id.ethz.ch> wrote:
> In my index I have some fields which have the same prefix(rmDocumentTitle, rmDocumentClass, rmDocumentSubclass, rmDocumentArt). Apparently it is not possible to specify a query like this:
>
> q = rm* : some_word
>
> Is there a way to do this without having to write a long list of ORs?
>
> Another question is if it is really not possible to search a word over 
> the entire index. Something like this: q = * : some_word
>
> Thank you
> Francesco

Re: Query and field name with wildcard

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Are you using eDisMax. That gives a lot of options, including field
aliasing, including a single name to multiple fields:
http://wiki.apache.org/solr/ExtendedDisMax#Field_aliasing_.2F_renaming
(with example on p77 of my book
http://www.packtpub.com/apache-solr-for-indexing-data/book :-)

Regards,
   Alex.

Personal website: http://www.outerthoughts.com/
Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency


On Fri, Apr 4, 2014 at 3:52 PM, Croci  Francesco Luigi (ID SWS)
<fc...@id.ethz.ch> wrote:
> In my index I have some fields which have the same prefix(rmDocumentTitle, rmDocumentClass, rmDocumentSubclass, rmDocumentArt). Apparently it is not possible to specify a query like this:
>
> q = rm* : some_word
>
> Is there a way to do this without having to write a long list of ORs?
>
> Another question is if it is really not possible to search a word over the entire index. Something like this: q = * : some_word
>
> Thank you
> Francesco