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 Valentina Cavazza <va...@step-net.it> on 2016/07/15 14:17:02 UTC

search documents that have a specific field populated

Hi,
I need to search documents that have a specific field populated, so I 
want to display all the documents that have the field not empty.
This field in schema is set multivalued=true, indexed=true, stored=true, 
default=EMPTY.
This field type is solr.TextField class, use StandardTokenizerFactory 
tokenizer, ICUFoldingFilterFactory filter, LowerCaseFilterFactory filter 
and GreekStemFilterFactory filter in index and query analizer.
I already tried queries like this:
q=field:*
q=+field:*
q=+field:[* TO *]
q=+field:['' TO *]
q=+field:["" TO *]
q=+field:[' ' TO *]
q=+field:' '
q=-field:EMPTY

but nothing found.
Someone know how to do that?
Thanks

Valentina

RE: search documents that have a specific field populated

Posted by "Jamal, Sarfaraz" <Sa...@VerizonWireless.com.INVALID>.
If I understand you properly, I do it using a Filter Query:

fq=NOT(field:EMPTY)

Hope that helps -

Sas


-----Original Message-----
From: Valentina Cavazza [mailto:valentina@step-net.it] 
Sent: Friday, July 15, 2016 10:17 AM
To: solr-user@lucene.apache.org
Subject: search documents that have a specific field populated

Hi,
I need to search documents that have a specific field populated, so I want to display all the documents that have the field not empty.
This field in schema is set multivalued=true, indexed=true, stored=true, default=EMPTY.
This field type is solr.TextField class, use StandardTokenizerFactory tokenizer, ICUFoldingFilterFactory filter, LowerCaseFilterFactory filter and GreekStemFilterFactory filter in index and query analizer.
I already tried queries like this:
q=field:*
q=+field:*
q=+field:[* TO *]
q=+field:['' TO *]
q=+field:["" TO *]
q=+field:[' ' TO *]
q=+field:' '
q=-field:EMPTY

but nothing found.
Someone know how to do that?
Thanks

Valentina

Re: search documents that have a specific field populated

Posted by Erick Erickson <er...@gmail.com>.
First of all I get an error message on startup with a field definition like:
default=EMPTY.

So I'm assuming you are puttint in quotes
default="EMPTY"

The query
q=field:[* TO *] should be fine, as is John's
query
fq:field:[* TO *]

So something's wonky here. I'd start by
deleting the entire index on the theory that
you're in a state you don't remember (i.e.
perhaps during some of your experiments
you now have docs with "EMPTY" in the field,
some blank and whatever else).

Second, don't provide any default for the field.

At that point q=field:[* TO *] should work. If it doesn't,
please post again with
1> a sample doc
2> the field definition exactly as in your schema
file (please copy/paste).
3> the results of adding &debug=query to the URL.

Best,
Erick

On Fri, Jul 15, 2016 at 8:16 AM, John Blythe <jo...@curvolabs.com> wrote:
> we use something in between: fq=fieldName[* TO *]
>
> --
> *John Blythe*
> Product Manager & Lead Developer
>
> 251.605.3071 | john@curvolabs.com
> www.curvolabs.com
>
> 58 Adams Ave
> Evansville, IN 47713
>
> On Fri, Jul 15, 2016 at 10:17 AM, Valentina Cavazza <va...@step-net.it>
> wrote:
>
>> Hi,
>> I need to search documents that have a specific field populated, so I want
>> to display all the documents that have the field not empty.
>> This field in schema is set multivalued=true, indexed=true, stored=true,
>> default=EMPTY.
>> This field type is solr.TextField class, use StandardTokenizerFactory
>> tokenizer, ICUFoldingFilterFactory filter, LowerCaseFilterFactory filter
>> and GreekStemFilterFactory filter in index and query analizer.
>> I already tried queries like this:
>> q=field:*
>> q=+field:*
>> q=+field:[* TO *]
>> q=+field:['' TO *]
>> q=+field:["" TO *]
>> q=+field:[' ' TO *]
>> q=+field:' '
>> q=-field:EMPTY
>>
>> but nothing found.
>> Someone know how to do that?
>> Thanks
>>
>> Valentina
>>

Re: search documents that have a specific field populated

Posted by John Blythe <jo...@curvolabs.com>.
we use something in between: fq=fieldName[* TO *]

-- 
*John Blythe*
Product Manager & Lead Developer

251.605.3071 | john@curvolabs.com
www.curvolabs.com

58 Adams Ave
Evansville, IN 47713

On Fri, Jul 15, 2016 at 10:17 AM, Valentina Cavazza <va...@step-net.it>
wrote:

> Hi,
> I need to search documents that have a specific field populated, so I want
> to display all the documents that have the field not empty.
> This field in schema is set multivalued=true, indexed=true, stored=true,
> default=EMPTY.
> This field type is solr.TextField class, use StandardTokenizerFactory
> tokenizer, ICUFoldingFilterFactory filter, LowerCaseFilterFactory filter
> and GreekStemFilterFactory filter in index and query analizer.
> I already tried queries like this:
> q=field:*
> q=+field:*
> q=+field:[* TO *]
> q=+field:['' TO *]
> q=+field:["" TO *]
> q=+field:[' ' TO *]
> q=+field:' '
> q=-field:EMPTY
>
> but nothing found.
> Someone know how to do that?
> Thanks
>
> Valentina
>