mirror of https://github.com/apache/lucene.git
SOLR-9490: Fixed bugs in BoolField that caused it to erroneously return "false" for all docs depending on usage
This commit is contained in:
parent
c6ab0e0f1b
commit
60ce8d7c54
|
@ -119,6 +119,8 @@ Bug Fixes
|
|||
* SOLR-9488: Shard split can fail to write commit data on shutdown/restart causing replicas to recover
|
||||
without replicating the index. This can cause data loss. (shalin)
|
||||
|
||||
* SOLR-9490: Fixed bugs in BoolField that caused it to erroneously return "false" for all docs depending
|
||||
on usage (Colvin Cowie, Dan Fox, hossman)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -128,11 +128,13 @@ public class BoolField extends PrimitiveFieldType {
|
|||
|
||||
@Override
|
||||
public String toExternal(IndexableField f) {
|
||||
if (f.binaryValue() == null) {
|
||||
return null;
|
||||
if (null != f.binaryValue()) {
|
||||
return indexedToReadable(f.binaryValue().utf8ToString());
|
||||
}
|
||||
|
||||
return indexedToReadable(f.binaryValue().utf8ToString());
|
||||
if (null != f.stringValue()) {
|
||||
return indexedToReadable(f.stringValue());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -182,12 +182,15 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
|
|||
// test a second query, test making a copy of the main query
|
||||
SolrQuery query2 = query.getCopy();
|
||||
query2.addFilterQuery("inStock:true");
|
||||
Assert.assertFalse(query.getFilterQueries() == query2.getFilterQueries());
|
||||
response = client.query( query2 );
|
||||
Assert.assertEquals(1, query2.getFilterQueries().length);
|
||||
Assert.assertEquals(0, response.getStatus());
|
||||
Assert.assertEquals(2, response.getResults().getNumFound() );
|
||||
Assert.assertFalse(query.getFilterQueries() == query2.getFilterQueries());
|
||||
|
||||
for (SolrDocument outDoc : response.getResults()) {
|
||||
assertEquals(true, outDoc.getFieldValue("inStock"));
|
||||
}
|
||||
|
||||
// sanity check round tripping of params...
|
||||
query = new SolrQuery("foo");
|
||||
query.addFilterQuery("{!field f=inStock}true");
|
||||
|
|
Loading…
Reference in New Issue