The record w...">

Why can't I find the "0" field in Solr?

From schema.xml:

<field name="myfield" type="integer" indexed="true" stored="false"/>

The record with identifier 5 has myfielda value of 0, which I confirmed by doing a plain search id:5and looking at objectXml.

Search id:5 AND myfield:0does not return records.

The search id:5 AND -myfield:1, however, returns the expected record.

Why?

- Additional Information:

Definition for integer type: <fieldType name="integer" class="solr.IntField" omitNorms="true"/>

Solr Version: 1.4

+3
source share
4 answers

I solved the problem. It was a bug in the application core (third-party CMS) and had nothing to do with Solr.

, , . , :

$value = strval($node);
if ($value)

, 0 false, "0".

:

$value = strval($node);
if ($value !== false)

... .

, - .

0

, ""? 0 ?

admin?

+1

, , int:

<fieldtype name="integer" class="solr.TrieIntField" ... />

. , integer - . .

0

. - , .

-1

Source: https://habr.com/ru/post/1767011/


All Articles