lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Rafalovitch <arafa...@gmail.com>
Subject Re: Not (!) operator
Date Fri, 27 May 2016 19:28:13 GMT
If you are worried about performance, bake the present/absent as a
signal in a separate field during the document processing as a special
UpdateRequestProcessor sequence.

Regards,
    Alex.

----
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 27 May 2016 at 17:13, Anil <anilklce@gmail.com> wrote:
> Hi Shawn,
>
> Thanks for reply. i am also worried wither performance.
> I will check if there is another way to design the documents in case of
> parent and child relationship.
>
> Regards,
> Anil
>
> On 27 May 2016 at 12:39, Shawn Heisey <apache@elyograg.org> wrote:
>
>> On 5/26/2016 11:13 PM, Anil wrote:
>> > We have status text field in our solr document and it is optional.
>> > search query status: !Closed returning documents with no status as
>> > well. how to get only documents having status and it is !Closed ? one
>> > way is status:* AND status:!Closed . any other way ? Thanks
>>
>> If you use status:* then you are doing a wildcard query.  If the status
>> field has a large number of unique values, this will be VERY slow.
>> Avoid wildcard queries unless they are the only way to accomplish what
>> you need.
>>
>> If the status field has more than a few possible values, the most
>> compact way to do this query efficiently would be:
>>
>> status:[* TO *]-status:Closed
>>
>> This could be written as:
>>
>> status:[* TO *] AND NOT status:Closed
>>
>> See this article about why this may not be the best way to write queries:
>>
>> https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/
>>
>> The [] syntax is a range query.  By starting and ending the range with
>> the * character, it means "all documents where status has a value".
>>
>> Thanks,
>> Shawn
>>
>>

Mime
View raw message