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 Jorge Agudo Praena <jo...@gmail.com> on 2009/09/30 11:39:41 UTC

Re: search for non empty field

Hi, i'm not having the expected results when using [* TO *], the results are
including empty fields.
Here is my configuration:

schema.xml:
<field name="refFaseExp" type="string" indexed="true" stored="true"
multiValued="true"/>

bean:
@Field
private List<String> refFaseExp= new ArrayList<String>();

query:
http://host.com/select?rows=0&facet=true&facet.field=refFaseExp&q=*:* AND
refFaseExp:[* TO *]

query results:
(...)
<lst name="facet_counts">
<lst name="facet_queries"/>
-
<lst name="facet_fields">
-
<lst name="refFaseExp">
<int name="">32</int>
(...)

I tried changing type="string" to "long" and nothing changed.
When I use -refFaseExp:[* TO *], results 0 documents.
Any idea? Thx in advance.


On Mon, Mar 31, 2008 at 2:07 PM, Matt Mitchell <go...@gmail.com> wrote:

> Thanks Erik. I think this is the thread here:
>
>
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200709.mbox/%3c67117A73-2208-401F-AB5D-148634C77C13@variogr.am%3e
>
> Matt
>
> On Sun, Mar 30, 2008 at 9:50 PM, Erik Hatcher <er...@ehatchersolutions.com>
> wrote:
>
> > Documents with a particular field can be matched using:
> >
> >      field:[* TO *]
> >
> > Or documents without a particular field with:
> >
> >      -field:[* TO *]
> >
> > An empty field?  Meaning one that was indexed but with no terms?  I'm
> > not sure about that one.  Seems like Hoss replied to something
> > similar on this last week or so though - check the archives.
> >
> >        Erik
> >
> >
> > On Mar 30, 2008, at 9:43 PM, Matt Mitchell wrote:
> > > I'm looking for the exact same thing.
> > >
> > > On Sun, Mar 30, 2008 at 8:45 PM, Ismail Siddiqui <is...@gmail.com>
> > > wrote:
> > >
> > >> Hi all,
> > >>
> > >>
> > >> I have a situation where i have to filter result on a non empty
> > >> field .
> > >> wild card wont work as it will have to match with a letter.
> > >> How can I form query to return result where a particular field is
> > >> non-empty
> > >> .
> > >>
> > >>
> > >>
> > >> Ismail
> > >>
> >
> >
>

Re: search for non empty field

Posted by Erik Hatcher <er...@gmail.com>.
field:[* TO *] matches documents that have that have one or more terms  
in that field.   If your indexer is sending a value, it'll end up with  
a term.

Note that changing from string to long requires reindexing, though  
that isn't the issue here.

	Erik



On Sep 30, 2009, at 2:39 AM, Jorge Agudo Praena wrote:

> Hi, i'm not having the expected results when using [* TO *], the  
> results are
> including empty fields.
> Here is my configuration:
>
> schema.xml:
> <field name="refFaseExp" type="string" indexed="true" stored="true"
> multiValued="true"/>
>
> bean:
> @Field
> private List<String> refFaseExp= new ArrayList<String>();
>
> query:
> http://host.com/select? 
> rows=0&facet=true&facet.field=refFaseExp&q=*:* AND
> refFaseExp:[* TO *]
>
> query results:
> (...)
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> -
> <lst name="facet_fields">
> -
> <lst name="refFaseExp">
> <int name="">32</int>
> (...)
>
> I tried changing type="string" to "long" and nothing changed.
> When I use -refFaseExp:[* TO *], results 0 documents.
> Any idea? Thx in advance.
>
>
> On Mon, Mar 31, 2008 at 2:07 PM, Matt Mitchell <go...@gmail.com>  
> wrote:
>
>> Thanks Erik. I think this is the thread here:
>>
>>
>> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200709.mbox/%3c67117A73-2208-401F-AB5D-148634C77C13@variogr.am%3e
>>
>> Matt
>>
>> On Sun, Mar 30, 2008 at 9:50 PM, Erik Hatcher <erik@ehatchersolutions.com 
>> >
>> wrote:
>>
>>> Documents with a particular field can be matched using:
>>>
>>>     field:[* TO *]
>>>
>>> Or documents without a particular field with:
>>>
>>>     -field:[* TO *]
>>>
>>> An empty field?  Meaning one that was indexed but with no terms?   
>>> I'm
>>> not sure about that one.  Seems like Hoss replied to something
>>> similar on this last week or so though - check the archives.
>>>
>>>       Erik
>>>
>>>
>>> On Mar 30, 2008, at 9:43 PM, Matt Mitchell wrote:
>>>> I'm looking for the exact same thing.
>>>>
>>>> On Sun, Mar 30, 2008 at 8:45 PM, Ismail Siddiqui <is...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>>
>>>>> I have a situation where i have to filter result on a non empty
>>>>> field .
>>>>> wild card wont work as it will have to match with a letter.
>>>>> How can I form query to return result where a particular field is
>>>>> non-empty
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>> Ismail
>>>>>
>>>
>>>
>>